관리-도구
편집 파일: DES3.cpython-311.pyc
� O�Dg � � � d Z ddlZddlmZ ddlmZmZmZmZ ddl m Z mZmZm Z e dd� � Zd� Zd � Zd � ZdZdZd ZdZdZdZdZdZdZdS )a� Module's constants for the modes of operation supported with Triple DES: :var MODE_ECB: :ref:`Electronic Code Book (ECB) <ecb_mode>` :var MODE_CBC: :ref:`Cipher-Block Chaining (CBC) <cbc_mode>` :var MODE_CFB: :ref:`Cipher FeedBack (CFB) <cfb_mode>` :var MODE_OFB: :ref:`Output FeedBack (OFB) <ofb_mode>` :var MODE_CTR: :ref:`CounTer Mode (CTR) <ctr_mode>` :var MODE_OPENPGP: :ref:`OpenPGP Mode <openpgp_mode>` :var MODE_EAX: :ref:`EAX Mode <eax_mode>` � N)�_create_cipher)�byte_string�bchr�bord�bstr)�load_pycryptodome_raw_lib�VoidPointer�SmartPointer�c_size_tzCrypto.Cipher._raw_des3a� int DES3_start_operation(const uint8_t key[], size_t key_len, void **pResult); int DES3_encrypt(const void *state, const uint8_t *in, uint8_t *out, size_t data_len); int DES3_decrypt(const void *state, const uint8_t *in, uint8_t *out, size_t data_len); int DES3_stop_operation(void *state); c � �� d� �t | � � t vrt d� � �d� �fd�| D � � � � }|dd� |dd� k s|dd � |d d� k rt d � � �|S )am Set the parity bits in a TDES key. :param key_in: the TDES key whose bits need to be adjusted :type key_in: byte string :returns: a copy of ``key_in``, with the parity bits correctly set :rtype: byte string :raises ValueError: if the TDES key is not 16 or 24 bytes long :raises ValueError: if the TDES key degenerates into Single DES c �R � d}t dd� � D ] }|| |z dz z }�| dz |z S )N� � � )�range)�key_byte�parity�is �t/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/DES3.py�parity_bytez&adjust_key_parity.<locals>.parity_byteI sB � ����q�!��� *� *�A��x�1�}��)�)�F�F��4��6�)�)� zNot a valid TDES keyr c �Z �� g | ]'}t �t |� � � � � � ��(S � )r r )�.0�xr s �r � <listcomp>z%adjust_key_parity.<locals>.<listcomp>R s1 �� �E�E�E���k�k�$�q�'�'�2�2�3�3�E�E�Er Nr � i�i����z(Triple DES key degenerates to single DES)�len�key_size� ValueError�join)�key_in�key_outr s @r �adjust_key_parityr$ <