File: //home/arjun/projects/env/lib/python3.10/site-packages/Crypto/Hash/__pycache__/MD2.cpython-310.pyc
o
we� � @ sd d dl mZ d dlmZmZmZmZmZmZm Z edd�Z
G dd� de�Zd
dd �Z
ejZejZdS )� ��bord)�load_pycryptodome_raw_lib�VoidPointer�SmartPointer�create_string_buffer�get_raw_buffer�c_size_t�c_uint8_ptrzCrypto.Hash._MD2a�
int md2_init(void **shaState);
int md2_destroy(void *shaState);
int md2_update(void *hs,
const uint8_t *buf,
size_t len);
int md2_digest(const void *shaState,
uint8_t digest[20]);
int md2_copy(const void *src, void *dst);
c @ sP e Zd ZdZdZdZdZddd�Zdd� Zd d
� Z dd� Z
d
d� Zddd�ZdS )�MD2Hasha� An MD2 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.2.840.113549.2.2Nc C sL t � }t�|�� �}|rtd| ��t|�� tj�| _|r$| � |� d S d S )N� Error %d while instantiating MD2)
r �_raw_md2_lib�md2_init�
address_of�
ValueErrorr �get�md2_destroy�_state�update)�self�data�state�result� r �H/home/arjun/projects/env/lib/python3.10/site-packages/Crypto/Hash/MD2.py�__init__K s ���zMD2Hash.__init__c C s4 t �| j�� t|�tt|���}|rtd| ��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.
r
N)r �
md2_updater r r
r �lenr )r r r r r r r V s
���zMD2Hash.updatec C s4 t | j�}t�| j�� |�}|rtd| ��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 �
md2_digestr r r r )r �bfrr r r r �digestd s
��zMD2Hash.digestc C s d� dd� | �� 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 S s g | ]}d t |� �qS )z%02xr )�.0�xr r r �
<listcomp>} s z%MD2Hash.hexdigest.<locals>.<listcomp>)�joinr"