Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/hmac.cpython-39.opt-1.pyc

a

R�f[�@s�dZddlZzddlZWn&ey>dZdZddlmZ	Yn0e
ej�Zej	Z	ddlZe
dd�ed�D��Ze
dd�ed�D��ZdZGdd	�d	�Zddd�Zd
d�ZdS)zqHMAC (Keyed-Hashing for Message Authentication) module.

Implements the HMAC algorithm as described by RFC 2104.
�N)�_compare_digestccs|]}|dAVqdS)�\N���.0�xrr�)/opt/alt/python39/lib64/python3.9/hmac.py�	<genexpr>�r	�ccs|]}|dAVqdS)�6Nrrrrrr	r
c@szeZdZdZdZdZddd�Zedd	��Zed
d��Z	edd
��Z
edd��Zdd�Zdd�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�csFt|ttf�s tdt|�j���s,td��t��r<�|_n,t�t�rXd�fdd�	|_nd�fdd�	|_|��|_	|��|_
|j
j|_t|j
d�r�|j
j
}|dkr�t�d	||jftd
�|j}nt�d|jtd
�|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
cst��|�S�N��_hashlib�new��d��	digestmodrr�<lambda>=r
zHMAC.__init__.<locals>.<lambda>cs
��|�Sr�rrrrrr?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�strrrr�hasattrr�	_warnings�warn�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr-rrr�__init__&sF



����
z
HMAC.__init__cCsd|jjS)Nzhmac-)r�name�r6rrrr:_sz	HMAC.namecCs|jSr)rr;rrr�digest_conscszHMAC.digest_conscCs|jSr)rr;rrr�innergsz
HMAC.innercCs|jSr)rr;rrr�outerksz
HMAC.outercCs|j�|�dS)z,Feed data from msg into this hashing object.N)rr2)r6r8rrrr2oszHMAC.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__rrr�copyr)r6�otherrrrrAssz	HMAC.copycCs|j��}|�|j���|S)zwReturn a hash object for the current state.

        To be used only internally with digest() and hexdigest().
        )rrAr2rr0�r6�hrrr�_current�s
z
HMAC._currentcCs|��}|��S)z�Return the hash value of this hashing object.

        This returns the hmac value as bytes.  The object is
        not altered in any way by this function; you can continue
        updating the object after calling this function.
        )rEr0rCrrrr0�szHMAC.digestcCs|��}|��S)zKLike digest(), but returns a string of hexadecimal digits instead.
        )rE�	hexdigestrCrrrrF�szHMAC.hexdigest)Nr)r'�
__module__�__qualname__�__doc__r-�	__slots__r9�propertyr:r<r=r>r2rArEr0rFrrrrr
s"
9




	
r
rcCst|||�S)a�Create a new hashing object and return it.

    key: bytes or buffer, The starting key for the hash.
    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.

    You can now feed arbitrary bytes into the object using its update()
    method, and can ask for the hash value at any time by calling its digest()
    or hexdigest() methods.
    )r
)r7r8rrrrr�srcs�tdur(t�t�r(�tvr(t�||��St��r6�}n(t�t�rPd	�fdd�	}nd
�fdd�	}|�}|�}t|dd�}t|�|kr�||���}|d|t|�}|�	|�
t��|�	|�
t��|�	|�|�	|���|��S)aJFast inline implementation of HMAC.

    key: bytes or buffer, The key for the keyed hash object.
    msg: bytes or buffer, 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.
    Nr
cst��|�Srrr�r0rrr�r
zdigest.<locals>.<lambda>cs
��|�SrrrrLrrr�r
rrr!)r
)r
)
�_hashopensslr"r)�_openssl_md_methsZhmac_digestr(�getattrr/r0r2r3r5r4)r7r8r0r<r=r>r-rrLrr0�s,	��

r0)Nr)rI�warningsr+rrM�ImportErrorrN�	_operatorrZcompare_digest�	frozensetZopenssl_md_meth_namesZhashlibr#�ranger4r5rr
rr0rrrr�<module>s 
~


Hacked By AnonymousFox1.0, Coded By AnonymousFox