Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/Cryptodome/Cipher/__pycache__/ARC4.cpython-39.pyc
Ðазад
a c�h0 � @ sb d dl mZ d dlmZmZmZmZmZmZm Z edd�Z G dd� d�Zdd� Zd Z ed d�ZdS ) � )�b)�load_pycryptodome_raw_lib�VoidPointer�create_string_buffer�get_raw_buffer�SmartPointer�c_size_t�c_uint8_ptrzCryptodome.Cipher._ARC4al int ARC4_stream_encrypt(void *rc4State, const uint8_t in[], uint8_t out[], size_t len); int ARC4_stream_init(uint8_t *key, size_t keylen, void **pRc4State); int ARC4_stream_destroy(void *rc4State); c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) � ARC4CipherzgARC4 cipher object. Do not create it directly. Use :func:`Cryptodome.Cipher.ARC4.new` instead. c O s� t |�dkr"|d }|dd� }n|�dd�}t |�tvrJtdt |� ��t� | _t�t|�t t |��| j� � �}|dkr�td| ��t| j�� tj �| _|dkr�| �d| � d| _t |�| _dS )zOInitialize an ARC4 cipher object See also `new()` at the module level.r � NZdropz$Incorrect ARC4 key length (%d bytes)z'Error %d while creating the ARC4 cipher� )�len�pop�key_size� ValueErrorr �_state� _raw_arc4_libZARC4_stream_initr r Z address_ofr �getZARC4_stream_destroy�encrypt� block_size)�self�key�args�kwargsZndrop�result� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/Cryptodome/Cipher/ARC4.py�__init__, s0 � �� �zARC4Cipher.__init__c C sF t t|��}t�| j�� t|�|tt|���}|r>td| ��t |�S )z�Encrypt a piece of data. :param plaintext: The data to encrypt, of any size. :type plaintext: bytes, bytearray, memoryview :returns: the encrypted byte string, of equal length as the plaintext. z"Error %d while encrypting with RC4) r r r ZARC4_stream_encryptr r r r r r )r Z plaintext� ciphertextr r r r r N s �zARC4Cipher.encryptc C sJ z| � |�W S tyD } z tt|��dd���W Y d}~n d}~0 0 dS )z�Decrypt a piece of data. :param ciphertext: The data to decrypt, of any size. :type ciphertext: bytes, bytearray, memoryview :returns: the decrypted byte string, of equal length as the ciphertext. �enc�decN)r r �str�replace)r r �er r r �decrypt` s zARC4Cipher.decryptN)�__name__� __module__�__qualname__�__doc__r r r$ r r r r r '