관리-도구
편집 파일: RIPEMD160.cpython-311.pyc
� O�Dg� � � � d dl mZ d dlmZmZmZmZmZmZm Z edd� � Z G d� de� � Zd d�Z ej Zej ZdS ) � ��bord)�load_pycryptodome_raw_lib�VoidPointer�SmartPointer�create_string_buffer�get_raw_buffer�c_size_t�c_uint8_ptrzCrypto.Hash._RIPEMD160a int ripemd160_init(void **shaState); int ripemd160_destroy(void *shaState); int ripemd160_update(void *hs, const uint8_t *buf, size_t len); int ripemd160_digest(const void *shaState, uint8_t digest[20]); int ripemd160_copy(const void *src, void *dst); c �F � e Zd ZdZdZdZdZdd�Zd� Zd� Z d � Z d � Zdd�ZdS ) � RIPEMD160Hasha� A RIPEMD-160 hash object. Do not instantiate directly. Use the :func:`new` function. :ivar oid: ASN.1 Object ID :vartype oid: string :ivar block_size: the size in bytes of the internal message block, input to the compression function :vartype block_size: integer :ivar digest_size: the size in bytes of the resulting hash :vartype digest_size: integer � �@ z1.3.36.3.2.1Nc �6 � t � � }t � |� � � � � }|rt d|z � � �t |� � � t j � � | _ |r| � |� � d S d S )Nz&Error %d while instantiating RIPEMD160) r �_raw_ripemd160_lib�ripemd160_init� address_of� ValueErrorr �get�ripemd160_destroy�_state�update)�self�data�state�results �w/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/RIPEMD160.py�__init__zRIPEMD160Hash.__init__L s� � �� � ��#�2�2�5�3C�3C�3E�3E�F�F��� '��E�%�&� '� '� '�"�5�9�9�;�;�#5�#G�I� I���� ��K�K������� � � c �� � t � | j � � � t |� � t t |� � � � � � }|rt d|z � � �dS )z�Continue hashing of a message by consuming the next chunk of data. Args: data (byte string/byte array/memoryview): The next chunk of the message being hashed. �&Error %d while instantiating ripemd160N)r �ripemd160_updater r r r �lenr )r r r s r r zRIPEMD160Hash.updateW sv � � $�4�4�T�[�_�_�5F�5F�5@��5F�5F�5=�c�$�i�i�5H�5H�J� J�� � '��E�%�&� '� '� '� '� 'r c �� � t | j � � }t � | j � � � |� � }|rt d|z � � �t |� � S )z�Return the **binary** (non-printable) digest of the message that has been hashed so far. :return: The hash digest, computed over the data processed so far. Binary form. :rtype: byte string r! )r �digest_sizer �ripemd160_digestr r r r )r �bfrr s r �digestzRIPEMD160Hash.digeste so � � #�4�#3�4�4��#�4�4�T�[�_�_�5F�5F�58�:� :��� '��E�%�&� '� '� '� �c�"�"�"r c �d � d� d� | � � � D � � � � S )z�Return the **printable** digest of the message that has been hashed so far. :return: The hash digest, computed over the data processed so far. Hexadecimal encoded. :rtype: string � c �2 � g | ]}d t |� � z ��S )z%02xr )�.0�xs r � <listcomp>z+RIPEMD160Hash.hexdigest.<locals>.<listcomp>~ s# � �@�@�@�Q���a���(�@�@�@r )�joinr( )r s r � hexdigestzRIPEMD160Hash.hexdigestv s- � � �w�w�@�@�$�+�+�-�-�@�@�@�A�A�Ar c �� � t � � }t � | j � � � |j � � � � � }|rt d|z � � �|S )a4 Return a copy ("clone") of the hash object. The copy will have the same internal state as the original hash object. This can be used to efficiently compute the digests of strings that share a common initial substring. :return: A hash object of the same type z Error %d while copying ripemd160)r r �ripemd160_copyr r r )r �cloner s r �copyzRIPEMD160Hash.copy� se � � ����#�2�2�4�;�?�?�3D�3D�38�<�3C�3C�3E�3E�G� G��� J��?�&�H�I�I�I��r c � � t |� � S )z&Create a fresh RIPEMD-160 hash object.)r )r r s r �newzRIPEMD160Hash.new� s � � �T�"�"�"r �N) �__name__� __module__�__qualname__�__doc__r% � block_size�oidr r r( r0 r4 r6 � r r r r 5 s� � � � � � � � � �K��J� �C� � � � �'� '� '�#� #� #�"B� B� B�� � �$#� #� #� #� #� #r r Nc �D � t � � � | � � S )a# Create a new hash object. :parameter data: Optional. The very first chunk of the message to hash. It is equivalent to an early call to :meth:`RIPEMD160Hash.update`. :type data: byte string/byte array/memoryview :Return: A :class:`RIPEMD160Hash` hash object )r r6 )r s r r6 r6 � s � � �?�?���t�$�$�$r r7 )�Crypto.Util.py3compatr �Crypto.Util._raw_apir r r r r r r r �objectr r6 r% r<