File: //usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/crypto/__pycache__/umac.cpython-310.pyc
o
�h' � @ s d Z ddlZddlZddlZddlmZmZmZ erSejej Z
ee
egdf Zee
ej
egdf Zee
ej
egdf Zee
ej
e
gdf Zeeee ee gef ZdZdZdeddfd d
�ZdD ]Zej�e�Zern nqbdZer�ej�e�Zeed�\ZZ Z!Z"dS dS )
z=UMAC cryptographic hash (RFC 4418) wrapper for Nettle library� N)�
TYPE_CHECKING�Callable�Optionali i �size�return�_Newc s� d�� ��d�� d�}z
t t|d �� � W n ty t� Y nw t t|d ��t t|d ��t t|d ��t t|d ��G � ������fd d
�d
�}|jS )z9Function to build UMAC wrapper for a specific digest size�umac�nettle_�_� _ctx_size�set_key� set_nonce�update�digestc
s� e Zd ZdZ�ZeZ�d Z ddddee dee fdd �Z
e dd
e dee dee ddf� �fd
d�
�Zddd�Z
de ddf�fdd�Zde ddf�fdd�Zde f�fdd�Zdefdd�ZdS )z_build_umac.<locals>._UMACz|Wrapper for UMAC cryptographic hash
This class supports the cryptographic hash API defined in PEP 452.
� N�ctx�
_ByteArray�nonce�msgc S s* || _ |r
| �|� |r| �|� d S d S )N)�_ctxr
r )�selfr r r � r �G/usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/crypto/umac.py�__init__F s
�z#_build_umac.<locals>._UMAC.__init__�keyr �_UMACc s t �� �}�||� | |||�S )z Construct a new UMAC hash object)�ctypes�create_string_buffer)�clsr r r r )�
_context_size�_set_keyr r �newP s
z_build_umac.<locals>._UMAC.newc S s t �| jj�}| �|�S )z1Return a new hash object with this object's state)r r r �raw� __class__)r r r r r �copyZ s
z_build_umac.<locals>._UMAC.copyc � � | j t�t|��|� dS )z+Reset the nonce associated with this objectN�r r �c_size_t�len)r r )�
_set_noncer r r
` � z$_build_umac.<locals>._UMAC.set_noncec r% )zAdd the data in msg to the hashNr&