HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/crypto/__pycache__/umac.cpython-310.pyc
o

�h'�@sdZddlZddlZddlZddlmZmZmZerSejej	Z
ee
egdfZee
ej
egdfZee
ej
egdfZee
ej
e
gdfZeeeeeegefZdZdZdeddfd	d
�ZdD]Zej�e�ZernnqbdZer�ej�e�Zeed�\ZZ Z!Z"dSdS)
z=UMAC cryptographic hash (RFC 4418) wrapper for Nettle library�N)�
TYPE_CHECKING�Callable�Optionalii�size�return�_Newcs�d����d��d�}z
tt|d���Wnty t�Ynwtt|d��tt|d��tt|d��tt|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�eZdZdZ�ZeZ�dZ		ddddee	dee	fdd	�Z
e		dd
e	dee	dee	ddf��fd
d�
�Zddd�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�msgcSs*||_|r
|�|�|r|�|�dSdS)N)�_ctxr
r)�selfrrr�r�G/usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/crypto/umac.py�__init__Fs
�z#_build_umac.<locals>._UMAC.__init__�keyr�_UMACcs t���}�||�||||�S)z Construct a new UMAC hash object)�ctypes�create_string_buffer)�clsrrrr)�
_context_size�_set_keyrr�newPs

z_build_umac.<locals>._UMAC.newcSst�|jj�}|�|�S)z1Return a new hash object with this object's state)rrr�raw�	__class__)rrrrr�copyZs
z_build_umac.<locals>._UMAC.copyc��|jt�t|��|�dS)z+Reset the nonce associated with this objectN�rr�c_size_t�len)rr)�
_set_noncerrr
`�z$_build_umac.<locals>._UMAC.set_noncecr%)zAdd the data in msg to the hashNr&)rr)�_updaterrrer*z!_build_umac.<locals>._UMAC.updatecs(t�|j�}�|jt�|j�|�|jS)aReturn the hash and increment nonce to begin a new message

               .. note:: The hash is reset and the nonce is incremented
                         when this function is called. This doesn't match
                         the behavior defined in PEP 452.

            )rr�digest_sizerr'r")r�result)�_digestrrrjs	z!_build_umac.<locals>._UMAC.digestcSst�|����d�S)z3Return the digest as a string of hexadecimal digits�ascii)�binascii�b2a_hexr�decode)rrrr�	hexdigestwsz$_build_umac.<locals>._UMAC.hexdigest)NN)rr)�__name__�
__module__�__qualname__�__doc__�name�_UMAC_BLOCK_SIZE�
block_sizer,r�bytesr�classmethodr!r$r
rr�strr3r�rr.�_namer r)r+rrrr;s.�
�
���
	
r)�getattr�_nettle�AttributeError�_UMAC_DEFAULT_CTX_SIZEr!)r�_prefixrrr>r�_build_umac*s
�BrE)�nettle�	libnettlezlibnettle-6)� �@�`�)#r7r0r�ctypes.util�typingrrr�Array�c_charrr;�_SetKeyr'�	_SetNonce�_Update�_Digest�objectrr9rC�intrE�lib�util�find_library�_nettle_lib�cdll�LoadLibraryrA�map�umac32�umac64�umac96�umac128rrrr�<module>s2V��