ÿØÿà JPEG ÿþ;
| Server IP : 68.65.120.201 / Your IP : 216.73.216.126 Web Server : LiteSpeed System : Linux server179.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64 User : taxhyuvu ( 2294) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/imunify360/venv/lib/python3.11/site-packages/Crypto/Cipher/__pycache__/ |
Upload File : |
�
��gh� � � � d dl mZ d dlmZmZmZmZmZmZm Z m
Z
d dlmZ edd� � Z
G d� 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 �( � e Zd ZdZd� 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 |� � t vrt dt |� � z � � �t |� � dk rt dt |� � z � � �t dd|� � | _ t � � | _ t � t |� � t t |� � � � t |� � t t |� � � � | j � � � � � }|rt d� � �t | j �
� � t j � � | _ 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__6 s; � �
�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
� � |�t t |� � � � }n_|}t |� � st d� � �t |� � t |� � k rt dt |� � z � � �t
� | j � � � t |� � t |� � t t |� � � � � � }|rt d|z � � �|�t |� � S dS )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)r r r � TypeErrorr r �Salsa20_stream_encryptr r r
r r )r � plaintext�output�
ciphertextr s r �encryptzSalsa20Cipher.encryptS s � � �>�-�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"