§
    ‹r°dð)  ã                   ó˜   — d dl m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mZ  edd¦  «        Zd„ Z G d„ de¦  «        Zd	„ Zd
„ ZdZdZdS )é    )Úget_random_bytes)Ú_copy_bytes)	Úload_pycryptodome_raw_libÚcreate_string_bufferÚget_raw_bufferÚVoidPointerÚSmartPointerÚc_size_tÚc_uint8_ptrÚc_ulongÚis_writeable_bufferzCrypto.Cipher._chacha20aç  
                    int chacha20_init(void **pState,
                                      const uint8_t *key,
                                      size_t keySize,
                                      const uint8_t *nonce,
                                      size_t nonceSize);

                    int chacha20_destroy(void *state);

                    int chacha20_encrypt(void *state,
                                         const uint8_t in[],
                                         uint8_t out[],
                                         size_t len);

                    int chacha20_seek(void *state,
                                      unsigned long block_high,
                                      unsigned long block_low,
                                      unsigned offset);
                    int hchacha20(  const uint8_t key[32],
                                    const uint8_t nonce16[16],
                                    uint8_t subkey[32]);
                    c                 ó&  — t          | ¦  «        dk    sJ ‚t          |¦  «        dk    sJ ‚t          d¦  «        }t                               t	          | ¦  «        t	          |¦  «        t	          |¦  «        ¦  «        }|rt          d|z  ¦  «        ‚|S )Né    é   z,Error %d when deriving subkey with HChaCha20)ÚlenÚ	bytearrayÚ_raw_chacha20_libÚ	hchacha20r   Ú
ValueError)ÚkeyÚnonceÚsubkeyÚresults       ú[/var/www/pp.vulcan-creative.com/venv/lib/python3.11/site-packages/Crypto/Cipher/ChaCha20.pyÚ
_HChaCha20r   B   s‘   € åˆs‰8Œ8�rŠ>ˆ>ˆ>ˆ>Ýˆu‰:Œ:˜ÒÐÐÐå�r‰]Œ]€FÝ×(Ò(Ý˜CÑ Ô Ý˜EÑ"Ô"Ý˜FÑ#Ô#ñ%ô %€Fð ð RÝÐGÈ&ÑPÑQÔQÐQà€Mó    c                   ó8   — e Zd ZdZdZd„ Zd	d„Zd„ Zd	d„Zd„ Z	dS )
ÚChaCha20Cipherz¹ChaCha20 (or XChaCha20) cipher object.
    Do not create it directly. Use :py:func:`new` instead.

    :var nonce: The nonce with length 8, 12 or 24 bytes
    :vartype nonce: bytes
    é   c                 ó�  — t          dd|¦  «        | _        t          |¦  «        dk    r-t          ||dd…         ¦  «        }d|dd…         z   }d| _        nd| _        | j        }d| _        t          ¦   «         | _        t           	                    | j         
                    ¦   «         t          |¦  «        t          t          |¦  «        ¦  «        |t          t          |¦  «        ¦  «        ¦  «        }|rt          d|| j        fz  ¦  «        ‚t          | j                             ¦   «         t          j        ¦  «        | _        dS )	z\Initialize a ChaCha20/XChaCha20 cipher object

        See also `new()` at the module level.Né   r   ó       Ú	XChaCha20ÚChaCha20)ÚencryptÚdecryptz"Error %d instantiating a %s cipher)r   r   r   r   Ú_nameÚ_nextr   Ú_stater   Úchacha20_initÚ
address_ofr   r
   r   r	   ÚgetÚchacha20_destroy)Úselfr   r   r   s       r   Ú__init__zChaCha20Cipher.__init__\   s4  € õ
 !  t¨UÑ3Ô3ˆŒ
õ ˆu‰:Œ:˜ÒÐÝ˜S %¨¨¨¤*Ñ-Ô-ˆCØ %¨¨¨¤*Ñ,ˆEØ$ˆDŒJˆJà#ˆDŒJØ”JˆEà+ˆŒ
å!‘m”mˆŒÝ"×0Ò0Øœ×.Ò.Ñ0Ô0Ý# CÑ(Ô(Ý ¥ S¡¤Ñ*Ô*ØÝ ¥ U¡¤Ñ,Ô,ñ.ô .ˆð ð 	RÝÐAÀVØEIÄZðEQñ Qñ Rô Rð Rå" 4¤;§?¢?Ñ#4Ô#4Ý#4Ô#EñGô GˆŒˆˆr   Nc                 ól   — d| j         vrt          d¦  «        ‚d| _         |                      ||¦  «        S )a«  Encrypt a piece of data.

        Args:
          plaintext(bytes/bytearray/memoryview): The data to encrypt, of any size.
        Keyword Args:
          output(bytes/bytearray/memoryview): The location where the ciphertext
            is written to. If ``None``, the ciphertext is returned.
        Returns:
          If ``output`` is ``None``, the ciphertext is returned as ``bytes``.
          Otherwise, ``None``.
        r%   z-Cipher object can only be used for decryption)r%   )r(   Ú	TypeErrorÚ_encrypt)r.   Ú	plaintextÚoutputs      r   r%   zChaCha20Cipher.encrypt|   s;   € ð ˜DœJÐ&Ð&ÝÐKÑLÔLÐLØ!ˆŒ
Ø�}Š}˜Y¨Ñ/Ô/Ð/r   c           
      ó*  — |€t          t          |¦  «        ¦  «        }n_|}t          |¦  «        st          d¦  «        ‚t          |¦  «        t          |¦  «        k    rt	          dt          |¦  «        z  ¦  «        ‚t
                               | j                             ¦   «         t          |¦  «        t          |¦  «        t          t          |¦  «        ¦  «        ¦  «        }|rt	          d|| j        fz  ¦  «        ‚|€t          |¦  «        S dS )zEncrypt without FSM checksNz4output must be a bytearray or a writeable memoryviewz9output must have the same length as the input  (%d bytes)z!Error %d while encrypting with %s)r   r   r   r1   r   r   Úchacha20_encryptr)   r,   r   r
   r'   r   )r.   r3   r4   Ú
ciphertextr   s        r   r2   zChaCha20Cipher._encryptŽ   s  € ð ˆ>Ý-­c°)©n¬nÑ=Ô=ˆJˆJàˆJå& vÑ.Ô.ð XÝÐ VÑWÔWÐWå�9‰~Œ~¥ V¡¤Ò,Ð,Ý ð "0Ý25°i±.´.ñ"Añ Bô Bð Bõ #×3Ò3Ø)-¬¯ªÑ):Ô):Ý)4°YÑ)?Ô)?Ý)4°ZÑ)@Ô)@Ý)1µ#°i±.´.Ñ)AÔ)Añ	Cô Cˆð
 ð 	YÝÐ@ÀFÈDÌJÐCWÑWÑXÔXÐXàˆ>Ý! *Ñ-Ô-Ð-à�4r   c                 óò   — d| j         vrt          d¦  «        ‚d| _         	 |                      ||¦  «        S # t          $ r5}t          t	          |¦  «                             dd¦  «        ¦  «        ‚d}~ww xY w)a©  Decrypt a piece of data.

        Args:
          ciphertext(bytes/bytearray/memoryview): The data to decrypt, of any size.
        Keyword Args:
          output(bytes/bytearray/memoryview): The location where the plaintext
            is written to. If ``None``, the plaintext is returned.
        Returns:
          If ``output`` is ``None``, the plaintext is returned as ``bytes``.
          Otherwise, ``None``.
        r&   z-Cipher object can only be used for encryption)r&   ÚencÚdecN)r(   r1   r2   r   ÚstrÚreplace)r.   r7   r4   Úes       r   r&   zChaCha20Cipher.decryptª   s�   € ð ˜DœJÐ&Ð&ÝÐKÑLÔLÐLØ!ˆŒ
ð	;Ø—=’= ¨VÑ4Ô4Ð4øÝð 	;ð 	;ð 	;Ý�S ™VœVŸ^š^¨E°5Ñ9Ô9Ñ:Ô:Ð:øøøøð	;øøøs   ¡7 ·
A6Á0A1Á1A6c                 ó  — t          |d¦  «        \  }}|dz  }|dz	  }t                               | j                             ¦   «         t          |¦  «        t          |¦  «        |¦  «        }|rt          d|| j        fz  ¦  «        ‚dS )z¦Seek to a certain position in the key stream.

        Args:
          position (integer):
            The absolute position within the key stream, in bytes.
        é@   l   ÿÿ r   zError %d while seeking with %sN)Údivmodr   Úchacha20_seekr)   r,   r   r   r'   )r.   ÚpositionÚoffsetÚ	block_lowÚ
block_highr   s         r   ÚseekzChaCha20Cipher.seekÀ   sš   € õ " (¨BÑ/Ô/Ñˆ�&Ø˜zÑ)ˆ	Ø ‘^ˆ
å"×0Ò0Ø15´·²Ñ1BÔ1BÝ18¸Ñ1DÔ1DÝ18¸Ñ1CÔ1CØ17ñ	3ô 3ˆð ð 	VÝÐ=ÀÈÌÐ@TÑTÑUÔUÐUð	Vð 	Vr   )N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
block_sizer/   r%   r2   r&   rF   © r   r   r   r   R   sƒ   € € € € € ðð ð €JðGð Gð Gð@0ð 0ð 0ð 0ð$ð ð ð8;ð ;ð ;ð ;ð,Vð Vð Vð Vð Vr   r   c                 ó\  — t          | ¦  «        dk    rt          d¦  «        ‚|€t          d¦  «        x}}n>t          |¦  «        dk    rd|z   }n%t          |¦  «        dk    r|}nt          d¦  «        ‚t          | |¬¦  «                             d	¦  «        }|dd
…         |d
d…         |fS )zrDerive a tuple (r, s, nonce) for a Poly1305 MAC.

    If nonce is ``None``, a new 12-byte nonce is generated.
    r   z-Poly1305 with ChaCha20 requires a 32-byte keyNé   é   r"   z6Poly1305 with ChaCha20 requires an 8- or 12-byte nonce)r   r   s                                    r   )r   r   r   Únewr%   )r   r   Úpadded_nonceÚrss       r   Ú_derive_Poly1305_key_pairrS   Ö   s¼   € õ ˆ3�x„x�2‚~€~ÝÐHÑIÔIÐIà€}Ý/°Ñ3Ô3Ð3ˆ�u�uÝ	ˆU‰Œ�qŠˆð +¨UÑ2ˆˆÝ	ˆU‰Œ�rÒ	Ð	ØˆˆåÐQÑRÔRÐRå	�˜LÐ	)Ñ	)Ô	)×	1Ò	1°,Ñ	?Ô	?€BØˆcˆrˆcŒ7�B�r�s�s”G˜UÐ"Ð"r   c                  ó¬  — 	 |                       d¦  «        }n$# t          $ r}t          d|z  ¦  «        ‚d}~ww xY w|                       dd¦  «        }|€t          d¦  «        }t	          |¦  «        dk    rt          d¦  «        ‚t	          |¦  «        dvrt          d	¦  «        ‚| rt          d
t          | ¦  «        z   ¦  «        ‚t          ||¦  «        S )a}  Create a new ChaCha20 or XChaCha20 cipher

    Keyword Args:
        key (bytes/bytearray/memoryview): The secret key to use.
            It must be 32 bytes long.
        nonce (bytes/bytearray/memoryview): A mandatory value that
            must never be reused for any other encryption
            done with this key.

            For ChaCha20, it must be 8 or 12 bytes long.

            For XChaCha20, it must be 24 bytes long.

            If not provided, 8 bytes will be randomly generated
            (you can find them back in the ``nonce`` attribute).

    :Return: a :class:`Crypto.Cipher.ChaCha20.ChaCha20Cipher` object
    r   zMissing parameter %sNr   rO   r   z,ChaCha20/XChaCha20 key must be 32 bytes long)rO   rN   r!   z:Nonce must be 8/12 bytes(ChaCha20) or 24 bytes (XChaCha20)zUnknown parameters: )ÚpopÚKeyErrorr1   r   r   r   r;   r   )Úkwargsr   r=   r   s       r   rP   rP   ó   sä   € ð(4Ø�jŠj˜ÑÔˆˆøÝð 4ð 4ð 4ÝÐ.°Ñ2Ñ3Ô3Ð3øøøøð4øøøð �JŠJ�w Ñ%Ô%€EØ€}Ý  Ñ#Ô#ˆå
ˆ3�x„x�2‚~€~ÝÐGÑHÔHÐHå
ˆ5�z„z˜Ð$Ð$ÝÐUÑVÔVÐVàð >ÝÐ.µ°V±´Ñ<Ñ=Ô=Ð=å˜#˜uÑ%Ô%Ð%s   ‚ ˜
9¢4´9r   r   N)ÚCrypto.Randomr   ÚCrypto.Util.py3compatr   ÚCrypto.Util._raw_apir   r   r   r   r	   r
   r   r   r   r   r   Úobjectr   rS   rP   rK   Úkey_sizerL   r   r   ú<module>r]      s1  ðð> +Ð *Ð *Ð *Ð *Ð *à -Ð -Ð -Ð -Ð -Ð -ð7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð .Ð-Ð.Gðñô Ð ð2ð ð ð AVð AVð AVð AVð AV�Vñ AVô AVð AVðH#ð #ð #ð:&&ð &&ð &&ðR €
ð €€€r   