JFIF$        dd7 

Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/Crypto/Hash/__pycache__/HMAC.cpython-311.pyc

�

e��-61���~�ddlmZmZddlmZddlmZddlmZddlm	Z	ddl
mZddgZGd	�de
��Zd
d�ZdS)�)�bord�tobytes)�	unhexlify)�MD5)�BLAKE2s)�strxor)�get_random_bytes�new�HMACc�D�eZdZdZdd�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�ZdS)
rz�An HMAC hash object.
    Do not instantiate directly. Use the :func:`new` function.

    :ivar digest_size: the size in bytes of the resulting MAC tag
    :vartype digest_size: integer
    �Nc���|�t}|�d}|j|_||_t|t��r|���}	t
|��|jkr|d|jt
|��z
zz}nD|�|���	��}|d|jt
|��z
zz}n#t$rtd���wxYwt|dt
|��z��}|�|��|_
|j
�|��t|dt
|��z��}|�|��|_dS)Nr
�zHash type incompatible to HMAC�6�\)r�digest_size�
_digestmod�
isinstance�
memoryviewr�len�
block_sizer
�digest�AttributeError�
ValueErrorr�_inner�update�_outer)�self�key�msg�	digestmod�key_0�hash_k�
key_0_ipad�
key_0_opads        �r/builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/HMAC.py�__init__z
HMAC.__init__6se�����I��;��C�%�0���#����c�:�&�&�	 ��+�+�-�-�C�
	?��3�x�x�9�/�/�/��g��)=��C���)H�I�I���#���s�+�+�2�2�4�4����I�,@�3�v�;�;�,N�!O�O�����	?�	?�	?��=�>�>�>�	?����
�E�7�S��Z�Z�#7�8�8�
� �m�m�J�/�/�������3�����E�7�S��Z�Z�#7�8�8�
� �m�m�J�/�/����s
�A:C�C c�:�|j�|��|S)z�Authenticate the next chunk of message.

        Args:
            data (byte string/byte array/memoryview): The next chunk of data
        )rr)rr s  r&rzHMAC.update_s��	
����3�����r
c�T�|j�|j|j||��}|S)z2Carry out the expensive inner loop for PBKDF2-HMAC)r�_pbkdf2_hmac_assistrr)r�first_digest�
iterations�results    r&r*zHMAC._pbkdf2_hmac_assistis2����4�4�$(�K�$(�K�$0�$.�	0�0��
�
r
c��td|j���}|j���|_|j���|_|S)a+Return a copy ("clone") of the HMAC object.

        The copy will have the same internal state as the original HMAC
        object.
        This can be used to efficiently compute the MAC tag of byte
        strings that share a common initial substring.

        :return: An :class:`HMAC`
        sfake key)r!)rrr�copyr)r�new_hmacs  r&r/z	HMAC.copyssI����t��?�?�?���+�*�*�,�,����+�*�*�,�,����r
c��|j���}|�|j�����|���S)z�Return the **binary** (non-printable) MAC tag of the message
        authenticated so far.

        :return: The MAC tag digest, computed over the data processed so far.
                 Binary form.
        :rtype: byte string
        )rr/rrr)r�frozen_outer_hashs  r&rzHMAC.digest�sL��!�K�,�,�.�.��� � ���!3�!3�!5�!5�6�6�6� �'�'�)�)�)r
c��td��}tjd||���}tjd||������}|���|���krt	d���dS)ahVerify that a given **binary** MAC (computed by another party)
        is valid.

        Args:
          mac_tag (byte string/byte string/memoryview): the expected MAC of the message.

        Raises:
            ValueError: if the MAC does not match. It means that the message
                has been tampered with or that the MAC key is incorrect.
        ��)�digest_bitsr�datazMAC check failedN)r	rr
rr)r�mac_tag�secret�mac1�mac2s     r&�verifyzHMAC.verify�sw��"�"�%�%���{�s��W�E�E�E���{�s��T�[�[�]�]�K�K�K���;�;�=�=�D�K�K�M�M�)�)��/�0�0�0�*�)r
c�~�d�d�t|�����D����S)z�Return the **printable** MAC tag of the message authenticated so far.

        :return: The MAC tag, computed over the data processed so far.
                 Hexadecimal encoded.
        :rtype: string
        �c�2�g|]}dt|��z��S)z%02x)r)�.0�xs  r&�
<listcomp>z"HMAC.hexdigest.<locals>.<listcomp>�s3��7�7�7����a���(�7�7�7r
)�join�tupler)rs r&�	hexdigestzHMAC.hexdigest�sF���w�w�7�7�!&�t�{�{�}�}�!5�!5�7�7�7�8�8�	8r
c�d�|�tt|������dS)a~Verify that a given **printable** MAC (computed by another party)
        is valid.

        Args:
            hex_mac_tag (string): the expected MAC of the message,
                as a hexadecimal string.

        Raises:
            ValueError: if the MAC does not match. It means that the message
                has been tampered with or that the MAC key is incorrect.
        N)r<rr)r�hex_mac_tags  r&�	hexverifyzHMAC.hexverify�s,��	
���I�g�k�2�2�3�3�4�4�4�4�4r
�r
N)�__name__�
__module__�__qualname__�__doc__r'rr*r/rr<rErH�r
r&rr.s���������'0�'0�'0�'0�R���������&*�*�*�1�1�1�(	8�	8�	8�
5�
5�
5�
5�
5r
r
Nc�$�t|||��S)a=Create a new MAC object.

    Args:
        key (bytes/bytearray/memoryview):
            key for the MAC object.
            It must be long enough to match the expected security level of the
            MAC.
        msg (bytes/bytearray/memoryview):
            Optional. The very first chunk of the message to authenticate.
            It is equivalent to an early call to :meth:`HMAC.update`.
        digestmod (module):
            The hash to use to implement the HMAC.
            Default is :mod:`Crypto.Hash.MD5`.

    Returns:
        An :class:`HMAC` object
    )r)rr r!s   r&r
r
�s��&��S�)�$�$�$r
rI)�Crypto.Util.py3compatrr�binasciir�Crypto.Hashrr�Crypto.Util.strxorr�
Crypto.Randomr	�__all__�objectrr
rNr
r&�<module>rWs���D0�/�/�/�/�/�/�/�������������������%�%�%�%�%�%�*�*�*�*�*�*��&�/��Q5�Q5�Q5�Q5�Q5�6�Q5�Q5�Q5�h%�%�%�%�%�%r
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQeӓ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