JFIF$        dd7 

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

�

�^�]ޗ���x�ddlmZddlmZmZmZddlmZddlm	Z	m
Z
ddl	mZmZm
Z
Gd�de��Zd	�Zd
S)�)�	unhexlify)�bord�tobytes�is_bytes)�get_random_bytes�)�	cSHAKE128�SHA3_256)�_bytepad�_encode_str�
_right_encodec�<�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�	KMAC_Hashz[A KMAC hash object.
    Do not instantiate directly.
    Use the :func:`new` function.
    c��d|z|_||_d|_tt	t|����|��}|�||d��|_|r|j�|��dSdS)Nz2.16.840.1.101.3.4.2.sKMAC)	�oid�digest_size�_macrrr�_new�_cshake�update)	�self�data�key�mac_len�custom�oid_variant�cshake�rate�partial_newXs	         �u/builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/KMAC128.py�__init__zKMAC_Hash.__init__.s���+�[�8���"�����	���G�C�L�L� 9� 9�4�@�@���{�{�<���A�A����	&��L����%�%�%�%�%�	&�	&�c�f�|jrtd���|j�|��|S)z�Authenticate the next chunk of message.

        Args:
            data (bytes/bytearray/memoryview): The next chunk of the message to
            authenticate.
        z8You can only call 'digest' or 'hexdigest' on this object)r�	TypeErrorrr)rrs  r rzKMAC_Hash.update=s9���9�	X��V�W�W�W�����D�!�!�!��r"c���|jsS|j�t|jdz����|j�|j��|_|jS)z�Return the **binary** (non-printable) MAC tag of the message.

        :return: The MAC tag. Binary form.
        :rtype: byte string
        �)rrrr
r�read�rs r �digestzKMAC_Hash.digestKsV���y�	<��L���
�d�.>��.B� C� C�D�D�D���)�)�$�*:�;�;�D�I��y�r"c�~�d�d�t|�����D����S)z�Return the **printable** MAC tag of the message.

        :return: The MAC tag. Hexadecimal encoded.
        :rtype: string
        �c�2�g|]}dt|��z��S)z%02x)r)�.0�xs  r �
<listcomp>z'KMAC_Hash.hexdigest.<locals>.<listcomp>_s#��G�G�G�Q���a���(�G�G�Gr")�join�tupler)r(s r �	hexdigestzKMAC_Hash.hexdigestXs5���w�w�G�G�%����
�
�2F�2F�G�G�G�H�H�Hr"c��td��}tj||z��}tj||���z��}|���|���krt	d���dS)a`Verify that a given **binary** MAC (computed by another party)
        is valid.

        Args:
          mac_tag (bytes/bytearray/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.
        �zMAC check failedN)rr
�newr)�
ValueError)r�mac_tag�secret�mac1�mac2s     r �verifyzKMAC_Hash.verifyass��"�"�%�%���|�F�W�,�-�-���|�F�T�[�[�]�]�2�3�3���;�;�=�=�D�K�K�M�M�)�)��/�0�0�0�*�)r"c�d�|�tt|������dS)anVerify 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 �	hexverifyzKMAC_Hash.hexverifyus,��	
���I�g�k�2�2�3�3�4�4�4�4�4r"c�6�d|vr
|j|d<tdi|��S)zNReturn a new instance of a KMAC hash object.
        See :func:`new`.
        r�)rr5)r�kwargss  r r5z
KMAC_Hash.new�s,��
�F�"�"� $� 0�F�9���}�}�V�}�}�r"N)�__name__�
__module__�__qualname__�__doc__r!rr)r2r;r>r5r@r"r rr(s���������

&�
&�
&�������I�I�I�1�1�1�(5�5�5�����r"rc	���|�dd��}t|��std���t|��dkrt	d���|�dd��}|�dd��}|d	krt	d
���|�dd��}|rtd
t|��z���t
||||dtd��S)a�Create a new KMAC128 object.

    Args:
        key (bytes/bytearray/memoryview):
            The key to use to compute the MAC.
            It must be at least 128 bits long (16 bytes).
        data (bytes/bytearray/memoryview):
            Optional. The very first chunk of the message to authenticate.
            It is equivalent to an early call to :meth:`KMAC_Hash.update`.
        mac_len (integer):
            Optional. The size of the authentication tag, in bytes.
            Default is 64. Minimum is 8.
        custom (bytes/bytearray/memoryview):
            Optional. A customization byte string (``S`` in SP 800-185).

    Returns:
        A :class:`KMAC_Hash` hash object
    rNzYou must pass a key to KMAC128r4z1The key must be at least 128 bits long (16 bytes)rr�@r&z!'mac_len' must be 8 bytes or morerr"zUnknown parameters: �19�)�poprr$�lenr6�strrr	)rArrrrs     r r5r5�s���(�*�*�U�D�
!�
!�C��C�=�=�:��8�9�9�9�
�3�x�x�"�}�}��L�M�M�M��:�:�f�d�#�#�D��j�j��B�'�'�G���{�{��<�=�=�=�
�Z�Z��#�
&�
&�F�
�>��.��V���<�=�=�=��T�3����y�#�F�F�Fr"N)�binasciir�Crypto.Util.py3compatrrr�
Crypto.Randomrr+r	r
rrr
�objectrr5r@r"r �<module>rQs���>������9�9�9�9�9�9�9�9�9�9�*�*�*�*�*�*�!�!�!�!�!�!�!�!�;�;�;�;�;�;�;�;�;�;�c�c�c�c�c��c�c�c�L%G�%G�%G�%G�%Gr"
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ӓk yP7U*omQIs,K`)6\G3t?pgjrmۛجwluGtfh9uyP0D;Uڽ"OXlif$)&|ML0Zrm1[HXPlPR0'G=i2N+0e2]]9VTPO׮7h(F*癈'=QVZDF,d߬~TX G[`le69CR(!S2!P <0x<!1AQ "Ra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