Your IP : 3.147.86.30
3
� f� � @ sl d Z ddlZddlmZ ddlZedd� e d�D ��Z
edd� e d�D ��ZdZG dd � d �Z
dd
d�ZdS )
zxHMAC (Keyed-Hashing for Message Authentication) Python 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/python36/lib64/python3.6/hmac.py� <genexpr>
s r � c c s | ]}|d A V qdS )�6 Nr )r r r r r r s c @ sR e Zd ZdZdZddd�Zedd� �Zdd � Zd
d� Z dd
� Z
dd� Zdd� ZdS )�HMACz~RFC 2104 HMAC class. Also complies with RFC 4231.
This supports the API for Cryptographic Hash Functions (PEP 247).
�@ Nc sV t |ttf�s tdt|�j ��� dkr<tjdtd� t j
� t� �rL� | _n,t � t
�rhd� fdd� | _nd� fdd� | _| j� | _| j� | _| jj| _t| jd �r�| jj}|d
k r�tjd|| jf td� | j}ntjd| j td� | j}|| _t|�|k�r| j|�j� }|j|d
�}| jj|jt�� | jj|jt�� |dk �rR| j|� dS )a1 Create a new HMAC object.
key: key for the keyed hash object.
msg: Initial input for the hash, if provided.
digestmod: A module supporting PEP 247. *OR*
A hashlib constructor returning a new hash object. *OR*
A hash name suitable for hashlib.new().
Defaults to hashlib.md5.
Implicit default to hashlib.md5 is deprecated and will be
removed in Python 3.6.
Note: key and msg must be a bytes or bytearray objects.
z,key: expected bytes or bytearray, but got %rNz<HMAC() without an explicit digestmod argument is deprecated.� � c s t j� | �S )N)�_hashlib�new)�d)� digestmodr r �<lambda>4 s zHMAC.__init__.<locals>.<lambda>c s
� j | �S )N)r )r )r r r r 6 s �
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 )�
isinstance�bytes� bytearray� TypeError�type�__name__� _warnings�warn�PendingDeprecationWarningr Zmd5�callable�digest_cons�str�outer�inner�digest_size�hasattrr � blocksize�RuntimeWarning�len�digest�ljust�update� translate�trans_5C�trans_36)�self�key�msgr r'