Your IP : 18.218.1.38
a
R�f[ � @ s� d Z ddlZzddlZW n& ey> dZdZddlmZ Y n0 e
ej�Zej Z ddlZe
dd� ed�D ��Ze
dd� ed�D ��ZdZG dd � d �Zddd�Zd
d� ZdS )zqHMAC (Keyed-Hashing for Message Authentication) module.
Implements the HMAC algorithm as described by RFC 2104.
� N)�_compare_digestc c s | ]}|d A V qdS )�\ N� ��.0�xr r �)/opt/alt/python39/lib64/python3.9/hmac.py� <genexpr> � r � c c s | ]}|d A V qdS )�6 Nr r r r r r r
c @ sz e Zd ZdZdZdZddd�Zedd � �Zed
d� �Z edd
� �Z
edd� �Zdd� Zdd� Z
dd� Zdd� Zdd� ZdS )�HMACz~RFC 2104 HMAC class. Also complies with RFC 4231.
This supports the API for Cryptographic Hash Functions (PEP 247).
�@ )�_digest_cons�_inner�_outer�
block_size�digest_sizeN� c sF t |ttf�s tdt|�j ��� s,td��t� �r<� | _n,t � t�rXd� fdd� | _nd� fdd� | _| �� | _ | �� | _
| j
j| _t| j
d�r�| j
j
}|dk r�t�d || jf td
� | j}nt�d| j td
� | j}|| _
t|�|k� r�| �|��� }|�|d�}| j �|�t�� | j
�|�t�� |d
u�rB| �|� d
S )a? Create a new HMAC object.
key: bytes or buffer, key for the keyed hash object.
msg: bytes or buffer, Initial input for the hash or None.
digestmod: A hash name suitable for hashlib.new(). *OR*
A hashlib constructor returning a new hash object. *OR*
A module supporting PEP 247.
Required as of 3.8, despite its position after the optional
msg argument. Passing it as a keyword argument is
recommended, though not required for legacy API reasons.
z,key: expected bytes or bytearray, but got %rz'Missing required parameter 'digestmod'.r
c s t �� | �S �N��_hashlib�new��d�� digestmodr r �<lambda>= r
zHMAC.__init__.<locals>.<lambda>c s
� � | �S r �r r r r r r ? r
r � z:block_size of %d seems too small; using our default of %d.� z<No block_size attribute on given digest object; Assuming %d.� N)r
)r
)�
isinstance�bytes� bytearray� TypeError�type�__name__�callabler �strr r r �hasattrr � _warnings�warn� blocksize�RuntimeWarning�len�digest�ljust�update� translate�trans_5C�trans_36)�self�key�msgr r- r r r �__init__&