Ë
    (üàgá'  ã                   ó|   — d Z dgZddlmZ ddlmZmZmZmZm	Z	m
Z
mZmZ ddlmZ  edd«      Z G d„ de«      Zd	„ Zy
)z
Output Feedback (CFB) mode.
ÚOfbModeé    )Ú_copy_bytes)Úload_pycryptodome_raw_libÚVoidPointerÚcreate_string_bufferÚget_raw_bufferÚSmartPointerÚc_size_tÚc_uint8_ptrÚis_writeable_buffer)Úget_random_byteszCrypto.Cipher._raw_ofba  
                        int OFB_start_operation(void *cipher,
                                                const uint8_t iv[],
                                                size_t iv_len,
                                                void **pResult);
                        int OFB_encrypt(void *ofbState,
                                        const uint8_t *in,
                                        uint8_t *out,
                                        size_t data_len);
                        int OFB_decrypt(void *ofbState,
                                        const uint8_t *in,
                                        uint8_t *out,
                                        size_t data_len);
                        int OFB_stop_operation(void *state);
                        c                   ó&   — e Zd ZdZd„ Zdd„Zdd„Zy)r   a¼  *Output FeedBack (OFB)*.

    This mode is very similar to CBC, but it
    transforms the underlying block cipher into a stream cipher.

    The keystream is the iterated block encryption of the
    previous ciphertext block.

    An Initialization Vector (*IV*) is required.

    See `NIST SP800-38A`_ , Section 6.4.

    .. _`NIST SP800-38A` : http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf

    :undocumented: __init__
    c           	      ó   — t        «       | _        t        j                  |j	                  «       t        |«      t        t        |«      «      | j                  j                  «       «      }|rt        d|z  «      ‚t        | j                  j	                  «       t        j                  «      | _        |j                  «        t        |«      | _        	 t        dd|«      | _        	 | j                  | _        	 ddg| _        y)aS  Create a new block cipher, configured in OFB mode.

        :Parameters:
          block_cipher : C pointer
            A smart pointer to the low-level block cipher instance.

          iv : bytes/bytearray/memoryview
            The initialization vector to use for encryption or decryption.
            It is as long as the cipher block.

            **The IV must be a nonce, to to be reused for any other
            message**. It shall be a nonce or a random value.

            Reusing the *IV* for encryptions performed with the same key
            compromises confidentiality.
        z)Error %d while instantiating the OFB modeNÚencryptÚdecrypt)r   Ú_stateÚraw_ofb_libÚOFB_start_operationÚgetr   r
   ÚlenÚ
address_ofÚ
ValueErrorr	   ÚOFB_stop_operationÚreleaseÚ
block_sizer   ÚivÚIVÚ_next)ÚselfÚblock_cipherr   Úresults       úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/Crypto/Cipher/_mode_ofb.pyÚ__init__zOfbMode.__init__I   sÛ   € ô$ "“mˆŒÜ×0Ñ0°×1AÑ1AÓ1CÜ1<¸R³Ü19¼#¸b»'Ó1BØ15·±×1GÑ1GÓ1IóKˆñ ÜÐHØ%ñ&ó 'ð 'ô
 # 4§;¡;§?¡?Ó#4Ü#.×#AÑ#AóCˆŒð
 	×ÑÔä˜b›'ˆŒØ@ä˜d D¨"Ó-ˆŒð	&ð —'‘'ˆŒØà Ð+ˆ�
ó    Nc           
      óâ  — d| j                   vrt        d«      ‚dg| _         |€t        t        |«      «      }nF|}t	        |«      st        d«      ‚t        |«      t        |«      k7  rt        dt        |«      z  «      ‚t        j                  | j                  j                  «       t        |«      t        |«      t        t        |«      «      «      }|rt        d|z  «      ‚|€t        |«      S y)aõ  Encrypt data with the key and the parameters set at initialization.

        A cipher object is stateful: once you have encrypted a message
        you cannot encrypt (or decrypt) another message using the same
        object.

        The data to encrypt can be broken up in two or
        more pieces and `encrypt` can be called multiple times.

        That is, the statement:

            >>> c.encrypt(a) + c.encrypt(b)

        is equivalent to:

             >>> c.encrypt(a+b)

        This function does not add any padding to the plaintext.

        :Parameters:
          plaintext : bytes/bytearray/memoryview
            The piece of data to encrypt.
            It can be of any length.
        :Keywords:
          output : bytearray/memoryview
            The location where the ciphertext must be written to.
            If ``None``, the ciphertext is returned.
        :Return:
          If ``output`` is ``None``, the ciphertext is returned as ``bytes``.
          Otherwise, ``None``.
        r   z*encrypt() cannot be called after decrypt()Nú4output must be a bytearray or a writeable memoryviewú9output must have the same length as the input  (%d bytes)z%Error %d while encrypting in OFB mode)r   Ú	TypeErrorr   r   r   r   r   ÚOFB_encryptr   r   r   r
   r   )r   Ú	plaintextÚoutputÚ
ciphertextr!   s        r"   r   zOfbMode.encrypty   sè   € ðB ˜DŸJ™JÑ&ÜÐHÓIÐIØ�[ˆŒ
àˆ>Ü-¬c°)«nÓ=‰JàˆJä& vÔ.ÜÐ VÓWÐWä�9‹~¤ V£Ò,Ü ð "0Ü25°i³.ñ"Aó Bð Bô ×(Ñ(¨¯©¯©Ó):Ü)4°YÓ)?Ü)4°ZÓ)@Ü)1´#°i³.Ó)AóCˆñ ÜÐDÀvÑMÓNÐNàˆ>Ü! *Ó-Ð-àr$   c           
      óâ  — d| j                   vrt        d«      ‚dg| _         |€t        t        |«      «      }nF|}t	        |«      st        d«      ‚t        |«      t        |«      k7  rt        dt        |«      z  «      ‚t        j                  | j                  j                  «       t        |«      t        |«      t        t        |«      «      «      }|rt        d|z  «      ‚|€t        |«      S y)aò  Decrypt data with the key and the parameters set at initialization.

        A cipher object is stateful: once you have decrypted a message
        you cannot decrypt (or encrypt) another message with the same
        object.

        The data to decrypt can be broken up in two or
        more pieces and `decrypt` can be called multiple times.

        That is, the statement:

            >>> c.decrypt(a) + c.decrypt(b)

        is equivalent to:

             >>> c.decrypt(a+b)

        This function does not remove any padding from the plaintext.

        :Parameters:
          ciphertext : bytes/bytearray/memoryview
            The piece of data to decrypt.
            It can be of any length.
        :Keywords:
          output : bytearray/memoryview
            The location where the plaintext is written to.
            If ``None``, the plaintext is returned.
        :Return:
          If ``output`` is ``None``, the plaintext is returned as ``bytes``.
          Otherwise, ``None``.
        r   z*decrypt() cannot be called after encrypt()Nr&   r'   z%Error %d while decrypting in OFB mode)r   r(   r   r   r   r   r   ÚOFB_decryptr   r   r   r
   r   )r   r,   r+   r*   r!   s        r"   r   zOfbMode.decrypt¶   sè   € ðB ˜DŸJ™JÑ&ÜÐHÓIÐIØ�[ˆŒ
àˆ>Ü,¬S°«_Ó=‰IàˆIä& vÔ.ÜÐ VÓWÐWä�:‹¤# f£+Ò-Ü ð "0Ü25°i³.ñ"Aó Bð Bô ×(Ñ(¨¯©¯©Ó):Ü)4°ZÓ)@Ü)4°YÓ)?Ü)1´#°j³/Ó)BóDˆñ ÜÐDÀvÑMÓNÐNàˆ>Ü! )Ó,Ð,àr$   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r#   r   r   © r$   r"   r   r   7   s   „ ñò".,ó`;ôz;r$   c                 óp  — | j                  |«      }|j                  dd«      }|j                  dd«      }d||fk(  rt        | j                  «      }|�|�t	        d«      ‚|}t        |«      | j                  k7  rt        d| j                  z  «      ‚|rt	        dt        |«      z  «      ‚t        ||«      S )aó  Instantiate a cipher object that performs OFB encryption/decryption.

    :Parameters:
      factory : module
        The underlying block cipher, a module from ``Crypto.Cipher``.

    :Keywords:
      iv : bytes/bytearray/memoryview
        The IV to use for OFB.

      IV : bytes/bytearray/memoryview
        Alias for ``iv``.

    Any other keyword will be passed to the underlying block cipher.
    See the relevant documentation for details (at least ``key`` will need
    to be present).
    r   Nr   )NNz*You must either use 'iv' or 'IV', not bothz.Incorrect IV length (it must be %d bytes long)zUnknown parameters for OFB: %s)	Ú_create_base_cipherÚpopr   r   r(   r   r   Ústrr   )ÚfactoryÚkwargsÚcipher_stater   r   s        r"   Ú_create_ofb_cipherr;   ô   sÂ   € ð& ×.Ñ.¨vÓ6€LØ	�‰�D˜$Ó	€BØ	�‰�D˜$Ó	€Bà˜˜B�xÒÜ˜g×0Ñ0Ó1ˆØ	€~Øˆ>ÜÐHÓIÐIàˆä
ˆ2ƒw�'×$Ñ$Ò$ÜÐIØ×"Ñ"ñ#ó $ð 	$ñ ÜÐ8¼3¸v»;ÑFÓGÐGä�< Ó$Ð$r$   N)r2   Ú__all__ÚCrypto.Util.py3compatr   ÚCrypto.Util._raw_apir   r   r   r   r	   r
   r   r   ÚCrypto.Randomr   r   Úobjectr   r;   r3   r$   r"   ú<module>rA      sQ   ðñ.ð ˆ+€å -÷7÷ 7ó 7õ
 +á'Ð(@ð Có *€ô$zˆfô zóz&%r$   