Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/hmac.cpython-37.pyc

B

� fu�@s�dZddlZddlmZyddlZWnek
r@dZdZ	YnXe
ej�Z	ddlZe
dd�ed�D��Ze
dd�ed�D��ZdZGdd	�d	�Zdd
d�Zdd
�ZdS)zxHMAC (Keyed-Hashing for Message Authentication) Python module.

Implements the HMAC algorithm as described by RFC 2104.
�N)�_compare_digestccs|]}|dAVqdS)�\N�)�.0�xrr�)/opt/alt/python37/lib64/python3.7/hmac.py�	<genexpr>sr�ccs|]}|dAVqdS)�6Nr)rrrrrrsc@sReZdZdZdZddd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdS)�HMACz~RFC 2104 HMAC class.  Also complies with RFC 4231.

    This supports the API for Cryptographic Hash Functions (PEP 247).
    �@NcsVt|ttf�s tdt|�j���dkr<t�dtd�t	j
�t��rL�|_n,t�t
�rhd�fdd�	|_nd�fdd�	|_|��|_|��|_|jj|_t|jd	�r�|jj}|d
kr�t�d||jftd�|j}nt�d|jtd�|j}||_t|�|k�r|�|���}|�|d
�}|j�|�t��|j�|�t��|dk	�rR|�|�dS)aBCreate 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 since Python
                   3.4 and will be removed in Python 3.8.

        Note: key and msg must be a bytes or bytearray objects.
        z,key: expected bytes or bytearray, but got %rNzhHMAC() without an explicit digestmod argument is deprecated since Python 3.4, and will be removed in 3.8��cst��|�S)N)�_hashlib�new)�d)�	digestmodrr�<lambda>=rzHMAC.__init__.<locals>.<lambda>cs
��|�S)N)r)r)rrrr?r�
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�DeprecationWarningrZmd5�callable�digest_cons�str�outer�inner�digest_size�hasattrr�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr'r)rr�__init__!sB





z
HMAC.__init__cCsd|jjS)Nzhmac-)r$�name)r0rrrr4_sz	HMAC.namecCs|j�|�dS)z8Update this hashing object with the string msg.
        N)r$r,)r0r2rrrr,cszHMAC.updatecCs:|j�|j�}|j|_|j|_|j��|_|j��|_|S)zyReturn a separate copy of this hashing object.

        An update to this copy won't affect the original object.
        )�	__class__�__new__r!r%r$�copyr#)r0�otherrrrr7hsz	HMAC.copycCs|j��}|�|j���|S)zwReturn a hash object for the current state.

        To be used only internally with digest() and hexdigest().
        )r#r7r,r$r*)r0�hrrr�_currentus
z
HMAC._currentcCs|��}|��S)z�Return the hash value of this hashing object.

        This returns a string containing 8-bit data.  The object is
        not altered in any way by this function; you can continue
        updating the object after calling this function.
        )r:r*)r0r9rrrr*~szHMAC.digestcCs|��}|��S)zKLike digest(), but returns a string of hexadecimal digits instead.
        )r:�	hexdigest)r0r9rrrr;�szHMAC.hexdigest)NN)
r�
__module__�__qualname__�__doc__r'r3�propertyr4r,r7r:r*r;rrrrrs
>
	
rcCst|||�S)aVCreate a new hashing object and return it.

    key: The starting key for the hash.
    msg: if available, will immediately be hashed into the object's starting
    state.

    You can now feed arbitrary strings into the object using its update()
    method, and can ask for the hash value at any time by calling its digest()
    method.
    )r)r1r2rrrrr�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)aeFast inline implementation of HMAC

    key:    key for the keyed hash object.
    msg:    input message
    digest: A hash name suitable for hashlib.new() for best performance. *OR*
            A hashlib constructor returning a new hash object. *OR*
            A module supporting PEP 247.

    Note: key and msg must be a bytes or bytearray objects.
    Nrcst��|�S)N)rr)r)r*rrr�rzdigest.<locals>.<lambda>cs
��|�S)N)r)r)r*rrr�rrrr)r)r)
�_hashopensslrr"�_openssl_md_methsZhmac_digestr �getattrr)r*r,r-r/r.)r1r2r*r!r$r#r'r)r*rr*�s&

r*)NN)r>�warningsr�	_operatorrZcompare_digestrr@�ImportErrorrA�	frozensetZopenssl_md_meth_namesZhashlibr�ranger.r/r%rrr*rrrr�<module>s

t


Hacked By AnonymousFox1.0, Coded By AnonymousFox