+
    '(jW*                         ^ RI Ht ^ RIHt ^ RIHtHtHtHtH	t	H
t
HtHtHt ]! RR4      tR t ! R R]4      tR	 tR
 t^t^ tR# )    )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                     \        V 4      ^ 8X  g   Q h\        V4      ^8X  g   Q h\        ^ 4      p\        P                  \	        V 4      \	        V4      \	        V4      4      pV'       d   \        RV,          4      hV# )    z,Error %d when deriving subkey with HChaCha20)len	bytearray_raw_chacha20_lib	hchacha20r   
ValueError)keynoncesubkeyresults   &&  K/home/ubuntu/cf-venv/lib/python3.14/site-packages/Crypto/Cipher/ChaCha20.py
_HChaCha20r   C   sp    s8r>>u:r]F((C E"F#%F G&PQQM    c                   N   a  ] tR t^St o Rt^tR tR	R ltR tR	R lt	R t
RtV tR# )
ChaCha20CipherzChaCha20 (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                f   \        RRV4      V n        \        V4      ^8X  d+   \        WR,          4      pRVR,          ,           pRV n        MRV n        V P                  pRV n        \        4       V n        \        P                  V P                  P                  4       \        V4      \        \        V4      4      V\        \        V4      4      4      pV'       d   \        RVV P                  3,          4      h\        V P                  P                  4       \        P                   4      V n        R# )	zTInitialize a ChaCha20/XChaCha20 cipher object

See also `new()` at the module level.NN   Nr    NN	XChaCha20ChaCha20z"Error %d instantiating a %s cipher       )encryptdecrypt)r   r   r   r   _name_nextr   _stater   chacha20_init
address_ofr   r
   r   r	   getchacha20_destroy)selfr   r   r   s   &&& r   __init__ChaCha20Cipher.__init__]   s    
 !tU3
 u:S*-C%*,E$DJ#DJJJE+
!m"00..0#C( S* U,. AVEIZZEQ Q R R"4;;??#4#4#E#EGr   Nc                j    RV P                   9  d   \        R4      hRV n         V P                  W4      # )ac  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%   ChaCha20Cipher.encrypt}   s2     DJJ&KLL!
}}Y//r   c           
        Vf   \        \        V4      4      pMRTp\        V4      '       g   \        R4      h\        V4      \        V4      8w  d   \	        R\        V4      ,          4      h\
        P                  V P                  P                  4       \        V4      \        V4      \        \        V4      4      4      pV'       d   \	        RW@P                  3,          4      hVf   \        V4      # R# )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   r2   r   r   chacha20_encryptr)   r,   r   r
   r'   r   )r.   r4   r5   
ciphertextr   s   &&&  r   r3   ChaCha20Cipher._encrypt   s     >-c)n=JJ&v.. VWW9~V,  "025i."A B B #33)-):)4Y)?)4Z)@)1#i.)A	C
 @FJJCWWXX>!*--r   c                    RV P                   9  d   \        R4      hRV n          V P                  W4      #   \         d*   p\        \	        T4      P                  RR4      4      hRp?ii ; i)aa  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encdecN)r&   )r(   r2   r3   r   strreplace)r.   r9   r5   es   &&& r   r&   ChaCha20Cipher.decrypt   sa     DJJ&KLL!
	;==44 	;SV^^E59::	;s   6 A*$A%%A*c                   \        V^@4      w  r#VR,          pV^ ,	          p\        P                  V P                  P	                  4       \        V4      \        V4      V4      pV'       d   \        RW`P                  3,          4      hR# )zSeek to a certain position in the key stream.

If you want to seek to a certain block,
use ``seek(block_number * 64)``.

Args:
  position (integer):
    The absolute position within the key stream, in bytes.
l    zError %d while seeking with %sN)divmodr   chacha20_seekr)   r,   r   r   r'   )r.   positionblock_numberoffset	block_low
block_highr   s   &&     r   seekChaCha20Cipher.seek   sz      &h3 :-	!R'
"00151B181D181C17	3 =@TTUU r   )r'   r(   r)   r   )N)__name__
__module____qualname____firstlineno____doc__
block_sizer/   r%   r3   r&   rJ   __static_attributes____classdictcell__)__classdict__s   @r   r   r   S   s3      JG@0$8;,V Vr   r   c                &   \        V 4      ^ 8w  d   \        R4      hVf   \        ^4      ;r!M8\        V4      ^8X  d   RV,           pM\        V4      ^8X  d   TpM\        R4      h\        WR7      P	                  R4      pVR,          VR,          V3# )zjDerive a tuple (r, s, nonce) for a Poly1305 MAC.

If nonce is ``None``, a new 12-byte nonce is generated.
z-Poly1305 with ChaCha20 requires a 32-byte keyr$   z6Poly1305 with ChaCha20 requires an 8- or 12-byte nonce)r   r   r   r!   s                                    )r   r   r   newr%   )r   r   padded_noncerss   &&  r   _derive_Poly1305_key_pairrY      s     3x2~HII}/33u	Uq +U2	Ur	QRR		)	1	1,	?Bc7BsGU""r   c                 z    V P                  R4      pT P                  RR4      pTf   \        ^4      p\	        T4      ^ 8w  d   \        R4      h\	        T4      R9  d   \        R4      hT '       d   \        R\        T 4      ,           4      h\        Y4      #   \         d   p\        RT,          4      hRp?ii ; i)	aM  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   z,ChaCha20/XChaCha20 key must be 32 bytes longz:Nonce must be 8/12 bytes(ChaCha20) or 24 bytes (XChaCha20)zUnknown parameters: )         )popKeyErrorr2   r   r   r   r>   r   )kwargsr   r@   r   s   ,   r   rV   rV      s    (4jj JJw%E} #
3x2~GHH
5z$UVV.V<==#%%!  4.2334s   B B:#B55B:N)Crypto.Randomr   Crypto.Util.py3compatr   Crypto.Util._raw_apir   r   r   r   r	   r
   r   r   r   r   r   objectr   rY   rV   rQ   key_size r   r   <module>rg      s`   > + -7 7 7 ..G 4 DVV DVN#:&&R 
 r   