ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/hmac.cpython-311.pyc

�

�f$��"�dZddlZ	ddlZejZeej��Zn#e	$r
dZdZddl
mZYnwxYwddlZe
d�ed��D����Ze
d�ed��D����ZdZGd�d��Zdd
�Zd�ZdS)
zqHMAC (Keyed-Hashing for Message Authentication) module.

Implements the HMAC algorithm as described by RFC 2104.
�N)�_compare_digestc#� K�|]	}|dzV��
dS)�\N���.0�xs  �+/opt/alt/python311/lib64/python3.11/hmac.py�	<genexpr>r�&����0�0��!�d�(�0�0�0�0�0�0��c#� K�|]	}|dzV��
dS)�6Nrrs  r
rrrr
c�b�eZdZdZdZdZdd�Zd�Zd�Ze	d	���Z
d
�Zd�Zd�Z
d
�Zd�ZdS)�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_sizeN�c��t|ttf��s$tdt	|��jz���|std���trct|ttf��rG	|�	|||��dS#tj
$r|�|||��YdSwxYw|�|||��dS)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�2�	a��J�T�RU�Y�Y�M_�_�`�`�`��	F��D�E�E�E��	0�J�y�3�	�2B�C�C�	0�
4�����S�)�4�4�4�4�4���9�
4�
4�
4����s�C��3�3�3�3�3�3�
4����
�N�N�3��Y�/�/�/�/�/s�6B�&B9�8B9c��tj|||���|_|jj|_|jj|_dS)N)r+)r!�hmac_newrrrr's    r
r$zHMAC._init_hmacBs8��!�*�3��y�I�I�I��
��:�1����*�/����r
c�l��t���r�}n"t�t��rd
�fd�	}nd
�fd�	}d|_|��|_|��|_|jj|_t|jd��r?|jj}|dkr,tj
d||jfztd��|j}n*tj
d|jztd��|j}t|��|kr||�����}||_|�|d	��}|j�|�t$����|j�|�t&����|�|�|��dSdS)Nr
c�.��tj�|��S�N��_hashlib�new��dr+s �r
�<lambda>z HMAC._init_old.<locals>.<lambda>Ks�����Y��(B�(B�r
c�.����|��Sr1�r4r5s �r
r7z HMAC._init_old.<locals>.<lambda>Ms���	�
�
�a�(8�(8�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.��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_oldGs�����I���	9�#�K�K�
�	�3�
'�
'�	9�B�B�B�B�B�K�K�8�8�8�8�8�K���
�!�k�m�m���!�k�m�m����;�2����4�;��-�-�	'���.�I��2�~�~��� 0�3<�d�n�2M� N�-�q�2�2�2�!�N�	���N�*�-1�^�=�)�1�
.�
.�
.���I��s�8�8�i����+�c�"�"�)�)�+�+�C�$����i�i�	�5�)�)������3�=�=��2�2�3�3�3�����3�=�=��2�2�3�3�3��?��K�K��������?r
c�F�|jr|jjSd|jj��S)Nzhmac-)r�namer)r(s r
rMz	HMAC.namens)���:�	.��:�?�"�-�4�;�+�-�-�-r
c�L�|jp|j}|�|��dS)z,Feed data from msg into this hashing object.N)rrrG)r(r*�insts   r
rGzHMAC.updateus(���z�(�T�[�����C�����r
c�J�|j�|j��}|j|_|jr-|j���|_dx|_|_nCd|_|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�6�� �,����:�	.��*�/�/�+�+�E�K�*.�.�E�L�5�<�<��E�K��;�+�+�-�-�E�L��;�+�+�-�-�E�L��r
c��|jr|jS|j���}|�|j�����|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�sN��
�:�	��:���� � �"�"�A�
�H�H�T�[�'�'�)�)�*�*�*��Hr
c�R�|���}|���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�O���x�x�z�z�r
c�R�|���}|���S)zKLike digest(), but returns a string of hexadecimal digits instead.
        )rX�	hexdigestrVs  r
r[zHMAC.hexdigest�s��
�M�M�O�O���{�{�}�}�r
�Nr)r �
__module__�__qualname__�__doc__rB�	__slots__r,r$r&�propertyrMrGrSrXrEr[rr
r
rrs����������I��I�0�0�0�0�80�0�0�
%�%�%�N�.�.��X�.����
���"
�
�
��������r
rrc�$�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�8��t�Ht�ttf��r,	tj||���S#tj$rYnwxYwt
���r�}n"t�t��rd�fd�	}nd�fd�	}|��}|��}t|dd��}t|��|kr||���	��}|d|t|��z
zz}|�
|�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
c�.��tj�|��Sr1r2�r6rEs �r
r7zdigest.<locals>.<lambda>�s���H�L���$;�$;�r
c�.����|��Sr1r9res �r
r7zdigest.<locals>.<lambda>�s���F�J�J�q�M�M�r
rrr<r=)r!rr"r#�hmac_digestr%r>�getattrrDrErGrHrJrI)r)r*rErK�inner�outerrBs  `    r
rErE�s������J�v��Y�7G�$H�$H��	��+�C��f�=�=�=���5�	�	�	��D�	��������2����	�F�C�	 �	 �2�;�;�;�;�;���1�1�1�1�1���K�M�M�E��K�M�M�E���|�R�0�0�I�
�3�x�x�)����k�#���%�%�'�'��

��9�s�3�x�x�/�0�
0�C�	�L�L����x�(�(�)�)�)�	�L�L����x�(�(�)�)�)�	�L�L�����	�L�L������ � � ��<�<�>�>�s�<�A�
Ar\)r_�warningsr@r3r!�compare_digestr�openssl_sha256r#�ImportError�	_operatorr�hashlibr�rangerIrJrrr4rErr
r
�<module>rrsJ����
����2�#�#�#�#�"�0�N���\�0�1�1�I�I��
�<�<�<��L��I�;�;�;�;�;�;�;�;�<���������5�0�0�U�U�3�Z�Z�0�0�0�0�0���5�0�0�U�U�3�Z�Z�0�0�0�0�0����J�J�J�J�J�J�J�J�X%�%�%�%�( � � � � s�$�6�6

Zerion Mini Shell 1.0