AlkantarClanX12

Your IP : 3.16.135.226


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/hmac.cpython-312.opt-1.pyc

�

�Q�f$���dZddlZ	ddlZej
Zeej�ZddlZe
d�ed�D��Ze
d�ed�D��ZdZGd�d�Zdd	�Zd
�Zy#e	$r
dZdZddl
mZY�SwxYw)zqHMAC (Keyed-Hashing for Message Authentication) module.

Implements the HMAC algorithm as described by RFC 2104.
�N)�_compare_digestc#�&K�|]	}|dz���y�w)�\N���.0�xs  �+/opt/alt/python312/lib64/python3.12/hmac.py�	<genexpr>r�����0�Z��!�d�(�Z����c#�&K�|]	}|dz���y�w)�6Nrrs  r
rrrr
c�Z�eZdZdZdZdZdd�Zd�Zd�Ze	d��Z
d	�Zd
�Zd�Z
d�Zd
�Zy)�HMACz~RFC 2104 HMAC class.  Also complies with RFC 4231.

    This supports the API for Cryptographic Hash Functions (PEP 247).
    �@)�_hmac�_inner�_outer�
block_size�digest_sizeNc�l�t|ttf�s!tdt	|�j
z��|std��tr+t|ttf�r	|j|||�y|j|||�y#tj$r|j|||�YywxYw)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 argument 'digestmod'.N)�
isinstance�bytes�	bytearray�	TypeError�type�__name__�_hashopenssl�str�	_functype�
_init_hmac�UnsupportedDigestmodError�	_init_old��self�key�msg�	digestmods    r
�__init__z
HMAC.__init__&s����#��y�1�2��J�T�RU�Y�M_�M_�_�`�`���D�E�E��J�y�3�	�2B�C�
4�����S�)�4�
�N�N�3��Y�/�� �9�9�
4����s�C��3�
4�s�"B
�
&B3�2B3c��tj|||��|_|jj|_|jj|_y)N)r*)r �hmac_newrrrr&s    r
r#zHMAC._init_hmacBs;��!�*�*�3��y�I��
��:�:�1�1����*�*�/�/���c�b��t��r�}nt�t�rd	�fd�	}nd	�fd�	}d|_|�|_|�|_|j
j|_t|j
d�rR|j
j}|dkrktjd||jfztd�|j}n4tjd|jztd�|j}t|�|kDr||�j�}||_|j|d�}|jj!|j#t$��|j
j!|j#t&��|�|j!|�yy)
Nc�0��tj�|�S�N��_hashlib�new��dr*s �r
�<lambda>z HMAC._init_old.<locals>.<lambda>Ks������Y��(Br.c�&���j|�Sr1�r4r5s �r
r7z HMAC._init_old.<locals>.<lambda>Ms���	�
�
�a�(8r.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.��r.)�callablerr!rrrr�hasattrr�	_warnings�warn�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)r'r(r)r*�digest_consrBs   `  r
r%zHMAC._init_oldGsW����I��#�K�
�	�3�
'�B�K�8�K���
�!�m���!�m����;�;�2�2����4�;�;��-����.�.�I��2�~���� 0�3<�d�n�n�2M� N�-�q�2�!�N�N�	��N�N�*�-1�^�^�=�)�1�
.����I��s�8�i���c�"�)�)�+�C�$����i�i�	�5�)�������3�=�=��2�3������3�=�=��2�3��?��K�K���r.c�x�|jr|jjSd|jj��S)Nzhmac-)r�namer)r's r
rMz	HMAC.namens/���:�:��:�:�?�?�"��4�;�;�+�+�,�-�-r.c�Z�|jxs|j}|j|�y)z,Feed data from msg into this hashing object.N)rrrG)r'r)�insts   r
rGzHMAC.updateus ���z�z�(�T�[�[�����C�r.c�r�|jj|j�}|j|_|jr/|jj	�|_dx|_|_|Sd|_|j
j	�|_|jj	�|_|S)zyReturn a separate copy of this hashing object.

        An update to this copy won't affect the original object.
        N)�	__class__�__new__rr�copyrr)r'�others  r
rSz	HMAC.copyzs������&�&�t�~�~�6�� �,�,����:�:��*�*�/�/�+�E�K�*.�.�E�L�5�<�
���E�K��;�;�+�+�-�E�L��;�;�+�+�-�E�L��r.c��|jr|jS|jj�}|j|jj��|S)zwReturn a hash object for the current state.

        To be used only internally with digest() and hexdigest().
        )rrrSrGrrE�r'�hs  r
�_currentz
HMAC._current�sE��
�:�:��:�:����� � �"�A�
�H�H�T�[�[�'�'�)�*��Hr.c�B�|j�}|j�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.
        )rXrErVs  r
rEzHMAC.digest�s��
�M�M�O���x�x�z�r.c�B�|j�}|j�S)zKLike digest(), but returns a string of hexadecimal digits instead.
        )rX�	hexdigestrVs  r
r[zHMAC.hexdigest�s��
�M�M�O���{�{�}�r.�N�)r�
__module__�__qualname__�__doc__rB�	__slots__r+r#r%�propertyrMrGrSrXrEr[rr.r
rrsR����I��I�0�80�
%�N�.��.��
�"
��r.rc��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)r(r)r*s   r
r4r4�s��"��S�)�$�$r.c���t�.t�ttf�r	tj||��St
��r�}nt�t�rd�fd�	}nd�fd�	}|�}|�}t|dd�}t|�|kDr||�j�}|d|t|�z
zz}|j|jt��|j|jt��|j|�|j|j��|j�S#tj
$rY��wxYw)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.
    c�0��tj�|�Sr1r2�r6rEs �r
r7zdigest.<locals>.<lambda>�s���H�L�L���$;r.c�&���j|�Sr1r9rfs �r
r7zdigest.<locals>.<lambda>�s
���F�J�J�q�Mr.rrr<r=)r rr!r"�hmac_digestr$r>�getattrrDrErGrHrJrI)r(r)rErK�inner�outerrBs  `    r
rErE�s�����J�v��Y�7G�$H�	��+�+�C��f�=�=������	�F�C�	 �;��1���M�E��M�E���|�R�0�I�
�3�x�)���#��%�%�'��

��9�s�3�x�/�0�
0�C�	�L�L����x�(�)�	�L�L����x�(�)�	�L�L���	�L�L����� ��<�<�>���)�5�5�	��	�s�D<�<E�Er\)r`�warningsr@r3r �compare_digestr�openssl_sha256r"�ImportError�	_operatorr�hashlibr�rangerIrJrrr4rErr.r
�<module>rss����
�2�#�"�0�0�N��\�0�0�1�I���0�U�3�Z�0�0���0�U�3�Z�0�0����J�J�X%�( ��e�<��L��I�;�<�s�A,�,A>�=A>