3 �L�j��@s�ddlZddlmZddlZddlZddlZe dd�e d�D��Z e dd�e d�D��Z dZ Gdd�d�Zd d �ZGd d �d ej�Zej�r�eZdd d�ZdS)�N)�_compare_digestccs|]}|dAVqdS)�\N�)�.0�xrr�/usr/lib64/python3.6/hmac.py� sr�ccs|]}|dAVqdS)�6Nr)rrrrrr sc@sNeZdZdZddd�Zedd��Zdd�Zd d �Zd d �Z d d�Z dd�Z dS)�HMAC�@Ncsftj�rtd��t|ttf�s0tdt|�j���dkrLt j dt d�t j �t��r\�|_n,t�t�rxd�fdd� |_nd�fd d� |_|j�|_|j�|_|jj|_t|jd �r�|jj}|d kr�t j d ||jftd�|j}nt j d |jtd�|j}||_t|�|k�r|j|�j�}|j|d�}|jj|jt��|jj|jt��|dk �rb|j|�dS)Nz*This class is not available in FIPS mode. zUse hmac.new().z,key: expected bytes or bytearray, but got %rz;szHMAC.__init__..cs �j|�S)N)r)r)rrrr=s� block_size�z:block_size of %d seems too small; using our default of %d.z�szHMAC.hexdigest)NN) r� __module__� __qualname__r*r6�propertyr7r/r:r=r-r>rrrrr s A    r cCsX|dkrtd��t|t�r"|j�St|�r2|d�}t|tj�sFtd��|jj�j dd�S)Nz.'digestmod' argument is mandatory in FIPS moderz6Only OpenSSL hashlib hashes are accepted in FIPS mode.�_�-) rrr%�lowerr#rZHASHrr7�replace)rrrr�_get_openssl_name�s  rFc@seZdZddd�ZdS)� HMAC_opensslNcCsLt|ttf�s tdt|�j��t|�}tjj |||d�}|rH|j |�|S)Nz,key: expected bytes or bytearray, but got %r)r) rrrrrrrF� _hmacopensslr r9r/)�clsr4r5rr7�resultrrrr9�s zHMAC_openssl.__new__)NN)rr?r@r9rrrrrG�srGcCs t|||�S)N)r )r4r5rrrrr�s r)NN)�warningsr � _operatorrZcompare_digestZhashlibrrrHr�ranger1r2r(r rFrGrrrrrr�s z