Your IP : 18.119.124.204


Current Path : /lib64/python3.8/__pycache__/
Upload File :
Current File : //lib64/python3.8/__pycache__/hmac.cpython-38.opt-2.pyc

U

&�.e��@s�ddlZddlmZzddlZWnek
r<dZdZYnXe	ej
�ZddlZddlZddl
Z
edd�ed�D��Zedd�ed�D��ZdZGdd�d�Zd	d
�ZGdd�de
j�Ze��r�eZddd�Zdd�ZdS)�N)�_compare_digestccs|]}|dAVqdS)�\N���.0�xrr�/usr/lib64/python3.8/hmac.py�	<genexpr>sr	�ccs|]}|dAVqdS)�6Nrrrrrr	sc@sNeZdZdZddd�Zedd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�HMAC�@N�csVt��rtd��t|ttf�s0tdt|�j���s<td��t	��rL�|_
n,t�t�rhd�fdd�	|_
nd�fdd�	|_
|�
�|_|�
�|_
|j
j|_t|j
d�r�|j
j}|d	kr�t�d
||jftd�|j}nt�d|jtd�|j}||_t|�|k�r|�
|���}|�|d
�}|j�|�t��|j
�|�t��|dk	�rR|�|�dS)Nz9This class is not available in FIPS mode. Use hmac.new().�,key: expected bytes or bytearray, but got %rz'Missing required parameter 'digestmod'.�cst��|�S�N��_hashlib�new��d��	digestmodrr�<lambda>?rzHMAC.__init__.<locals>.<lambda>cs
��|�Sr�rrrrrrAr�
block_size�z:block_size of %d seems too small; using our default of %d.�z<No block_size attribute on given digest object; Assuming %d.�)r)r)�_hashlibopenssl�
get_fips_mode�
ValueError�
isinstance�bytes�	bytearray�	TypeError�type�__name__�callable�digest_cons�str�outer�inner�digest_size�hasattrr�	_warnings�warn�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr1rrr�__init__#sR
�



����
z
HMAC.__init__cCsd|jjS)Nzhmac-)r,�name)r:rrrr>asz	HMAC.namecCs t��rtd��|j�|�dS)Nz'hmac.HMAC is not available in FIPS mode)rr r!r,r6)r:r<rrrr6eszHMAC.updatecCs:|j�|j�}|j|_|j|_|j��|_|j��|_|Sr)�	__class__�__new__r)r-r,�copyr+)r:�otherrrrrAksz	HMAC.copycCs|j��}|�|j���|Sr)r+rAr6r,r4�r:�hrrr�_currentxs
z
HMAC._currentcCs|��}|��Sr)rEr4rCrrrr4�szHMAC.digestcCs|��}|��Sr)rE�	hexdigestrCrrrrF�szHMAC.hexdigest)Nr)r'�
__module__�__qualname__r1r=�propertyr>r6rArEr4rFrrrrrs
>

	
rcCsHt|t�r|��St|�r"|d�}t|tj�s6td��|j���dd�S)Nrz6Only OpenSSL hashlib hashes are accepted in FIPS mode.�_�-)	r"r*�lowerr(rZHASHr%r>�replacerrrr�_get_openssl_name�s
�rNc@seZdZddd�ZdS)�HMAC_opensslNcCsLt|ttf�s tdt|�j��t|�}tjj	|||d�}|rH|�
|�|S)Nrr)r"r#r$r%r&r'rN�_hmacopensslrr@r6)�clsr;r<rr>�resultrrrr@�s
zHMAC_openssl.__new__)NN)r'rGrHr@rrrrrO�srOrcCst|||�Sr)r)r;r<rrrrr�srcs�tdk	r(t�t�r(�tkr(t�||��St��r6�}n(t�t�rPd�fdd�	}nd	�fdd�	}|�}|�}t|dd�}t|�|kr�||���}|d|t|�}|�	|�
t��|�	|�
t��|�	|�|�	|���|��S)
Nrcst��|�Srrr�r4rrr�rzdigest.<locals>.<lambda>cs
��|�SrrrrSrrr�rrr
r)r)r)
�_hashopensslr"r*�_openssl_md_methsZhmac_digestr(�getattrr3r4r6r7r9r8)r;r<r4r)r,r+r1rrSrr4�s,	��

r4)Nr)�warningsr/�	_operatorrZcompare_digestrrT�ImportErrorrU�	frozensetZopenssl_md_meth_namesZhashlibrrPr#�ranger8r9r-rrNrOr rr4rrrr�<module>s(

u


?>