JFIF$        dd7 

Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/Crypto/Cipher/__pycache__/Salsa20.cpython-311.pyc

�

N��Hre���ddlmZddlmZmZmZmZmZmZm	Z	m
Z
ddlmZedd��Z
Gd�d��Zdd	�Zd
ZdZdS)
�)�_copy_bytes)�load_pycryptodome_raw_lib�create_string_buffer�get_raw_buffer�VoidPointer�SmartPointer�c_size_t�c_uint8_ptr�is_writeable_buffer)�get_random_byteszCrypto.Cipher._Salsa20a�
                    int Salsa20_stream_init(uint8_t *key, size_t keylen,
                                            uint8_t *nonce, size_t nonce_len,
                                            void **pSalsaState);
                    int Salsa20_stream_destroy(void *salsaState);
                    int Salsa20_stream_encrypt(void *salsaState,
                                               const uint8_t in[],
                                               uint8_t out[], size_t len);
                    c�(�eZdZdZd�Zdd�Zdd�ZdS)�
Salsa20Cipherz�Salsa20 cipher object. Do not create it directly. Use :py:func:`new`
    instead.

    :var nonce: The nonce with length 8
    :vartype nonce: byte string
    c
���t|��tvrtdt|��z���t|��dkrtdt|��z���tdd|��|_t��|_t�t|��tt|����t|��tt|����|j�����}|rtd���t|j�
��tj��|_d|_t|��|_dS)zQInitialize a Salsa20 cipher object

        See also `new()` at the module level.z+Incorrect key length for Salsa20 (%d bytes)�z-Incorrect nonce length for Salsa20 (%d bytes)Nz'Error %d instantiating a Salsa20 cipher�)�len�key_size�
ValueErrorr�noncer�_state�_raw_salsa20_lib�Salsa20_stream_initr
r	�
address_ofr�get�Salsa20_stream_destroy�
block_size)�self�keyr�results    �w/builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/Salsa20.py�__init__zSalsa20Cipher.__init__6s;��
�s�8�8�8�#�#��J�S�QT�X�X�U�V�V�V��u�:�:��?�?��L� ��Z�Z�(�)�)�
)�!��t�U�3�3��
�!�m�m���!�5�5�#�C�(�(� ��S���*�*�#�E�*�*� ��U���,�,���.�.�0�0�2�2���	H��F�G�G�G�"�4�;�?�?�#4�#4�#3�#J�L�L�������C����
�
�
�Nc
��|�tt|����}n_|}t|��std���t|��t|��krt	dt|��z���t
�|j���t|��t|��tt|������}|rt	d|z���|�t|��SdS)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``.
        Nz4output must be a bytearray or a writeable memoryviewz9output must have the same length as the input  (%d bytes)z&Error %d while encrypting with Salsa20)rrr�	TypeErrorrr�Salsa20_stream_encryptrrr
r	r)r�	plaintext�output�
ciphertextrs     r �encryptzSalsa20Cipher.encryptSs	���>�-�c�)�n�n�=�=�J�J��J�&�v�.�.�
X�� V�W�W�W��9�~�~��V���,�,� �"0�25�i�.�.�"A�B�B�B�"�8�8�)-����):�):�)4�Y�)?�)?�)4�Z�)@�)@�)1�#�i�.�.�)A�)A�	C�C��
�	P��E��N�O�O�O��>�!�*�-�-�-��4r"c��	|�||���S#t$r5}tt|���dd�����d}~wwxYw)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'�enc�decN)r)r�str�replace)rr(r'�es    r �decryptzSalsa20Cipher.decryptys^��	;��<�<�
�6�<�:�:�:���	;�	;�	;��S��V�V�^�^�E�5�9�9�:�:�:�����	;���s��
A�0A�A�N)�__name__�
__module__�__qualname__�__doc__r!r)r0�r"r rr.sV��������!�!�!�:$�$�$�$�L;�;�;�;�;�;r"rNc�D�|�td��}t||��S)a%Create a new Salsa20 cipher

    :keyword key: The secret key to use. It must be 16 or 32 bytes long.
    :type key: bytes/bytearray/memoryview

    :keyword nonce:
        A value that must never be reused for any other encryption
        done with this key. It must be 8 bytes long.

        If not provided, a random byte string will be generated (you can read
        it back via the ``nonce`` attribute of the returned object).
    :type nonce: bytes/bytearray/memoryview

    :Return: a :class:`Crypto.Cipher.Salsa20.Salsa20Cipher` object
    Nr)rr)rrs  r �newr8�s&��"
�}� ��#�#����e�$�$�$r"r)�� r1)�Crypto.Util.py3compatr�Crypto.Util._raw_apirrrrrr	r
r�
Crypto.Randomrrrr8rrr6r"r �<module>r>s��2.�-�-�-�-�-�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�+�*�*�*�*�*�,�,�-E��	�	��[;�[;�[;�[;�[;�[;�[;�[;�|%�%�%�%�.�
����r"
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQeӓk yP7U*omQIs,K`)6\G3t?pgjrmۛجwluGtfh9uyP0D;Uڽ"OXlif$)&|ML0Zrm1[HXPlPR0'G=i2N+0e2]]9VTPO׮7h(F*癈'=QVZDF,d߬~TX G[`le69CR(!S2!P <0x<!1AQ "Raq02Br#SCTb ?Ζ"]mH5WR7k.ۛ!}Q~+yԏz|@T20S~Kek *zFf^2X*(@8r?CIuI|֓>^ExLgNUY+{.RѪ τV׸YTD I62'8Y27'\TP.6d&˦@Vqi|8-OΕ]ʔ U=TL8=;6c| !qfF3aů&~$l}'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