Ë
    (üàg=  ã                   óp   — d dl mZ d dlmZmZmZ d dlmZ ddlm	Z	m
Z
 ddl	mZmZmZ  G d„ de«      Zd	„ Zy
)é    )Ú	unhexlify)ÚbordÚtobytesÚis_bytes)Úget_random_bytesé   )Ú	cSHAKE128ÚSHA3_256)Ú_bytepadÚ_encode_strÚ_right_encodec                   ó:   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
y	)
Ú	KMAC_Hashz[A KMAC hash object.
    Do not instantiate directly.
    Use the :func:`new` function.
    c                 óÜ   — d|z   | _         || _        d | _        t        t	        t        |«      «      |«      }|j                  ||d«      | _        |r| j                  j                  |«       y y )Nz2.16.840.1.101.3.4.2.s   KMAC)	ÚoidÚdigest_sizeÚ_macr   r   r   Ú_newÚ_cshakeÚupdate)	ÚselfÚdataÚkeyÚmac_lenÚcustomÚoid_variantÚcshakeÚrateÚpartial_newXs	            úQ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/Crypto/Hash/KMAC128.pyÚ__init__zKMAC_Hash.__init__.   sb   € ð +¨[Ñ8ˆŒØ"ˆÔàˆŒ	ä¤¬G°C«LÓ 9¸4Ó@ˆØ—{‘{ <°¸ÓAˆŒáØ�L‰L×Ñ Õ%ð ó    c                 ój   — | j                   rt        d«      ‚| j                  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   Ú	TypeErrorr   r   )r   r   s     r    r   zKMAC_Hash.update=   s.   € ð �9Š9ÜÐVÓWÐWà�‰×Ñ˜DÔ!Øˆr"   c                 óè   — | j                   s[| j                  j                  t        | j                  dz  «      «       | j                  j                  | j                  «      | _         | j                   S )zŽReturn the **binary** (non-printable) MAC tag of the message.

        :return: The MAC tag. Binary form.
        :rtype: byte string
        é   )r   r   r   r   r   Úread)r   s    r    ÚdigestzKMAC_Hash.digestK   sS   € ð �yŠyØ�L‰L×Ñ¤¨d×.>Ñ.>ÀÑ.BÓ CÔDØŸ™×)Ñ)¨$×*:Ñ*:Ó;ˆDŒIà�y‰yÐr"   c           	      ó�   — dj                  t        | j                  «       «      D �cg c]  }dt        |«      z  ‘Œ c}«      S c c}w )z„Return the **printable** MAC tag of the message.

        :return: The MAC tag. Hexadecimal encoded.
        :rtype: string
        Ú z%02x)ÚjoinÚtupler(   r   )r   Úxs     r    Ú	hexdigestzKMAC_Hash.hexdigestX   s5   € ð �w‰w´%¸¿¹»Ó2FÖG¨Q˜¤ a£Ó(ÒGÓHÐHùÒGs   §Ac                 óî   — t        d«      }t        j                  ||z   «      }t        j                  || j                  «       z   «      }|j                  «       |j                  «       k7  rt	        d«      ‚y)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.
        é   zMAC check failedN)r   r
   Únewr(   Ú
ValueError)r   Úmac_tagÚsecretÚmac1Úmac2s        r    ÚverifyzKMAC_Hash.verifya   s_   € ô " "Ó%ˆä�|‰|˜F WÑ,Ó-ˆÜ�|‰|˜F T§[¡[£]Ñ2Ó3ˆà�;‰;‹=˜DŸK™K›MÒ)ÜÐ/Ó0Ð0ð *r"   c                 óJ   — | j                  t        t        |«      «      «       y)an  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)r7   r   r   )r   Úhex_mac_tags     r    Ú	hexverifyzKMAC_Hash.hexverifyu   s   € ð 	�‰”Iœg kÓ2Ó3Õ4r"   c                 ó>   — d|vr| j                   |d<   t        di |¤ŽS )zNReturn a new instance of a KMAC hash object.
        See :func:`new`.
        r   © )r   r1   )r   Úkwargss     r    r1   zKMAC_Hash.newƒ   s(   € ð
 ˜FÑ"Ø $× 0Ñ 0ˆF�9Ñä‰}�V‰}Ðr"   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   r   r(   r.   r7   r:   r1   r<   r"   r    r   r   (   s+   „ ñò
&òòòIò1ò(5ór"   r   c            	      ól  — | j                  dd«      }t        |«      st        d«      ‚t        |«      dk  rt	        d«      ‚| j                  dd«      }| j                  dd«      }|d	k  rt	        d
«      ‚| j                  dd«      }| rt        dt        | «      z   «      ‚t        ||||dt        d«      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
    r   NzYou must pass a key to KMAC128r0   z1The key must be at least 128 bits long (16 bytes)r   r   é@   r&   z!'mac_len' must be 8 bytes or morer   r"   zUnknown parameters: Ú19é¨   )Úpopr   r$   Úlenr2   Ústrr   r	   )r=   r   r   r   r   s        r    r1   r1   Ž   s°   € ð( �*‰*�U˜DÓ
!€CÜ�CŒ=ÜÐ8Ó9Ð9Ü
ˆ3ƒx�"‚}ÜÐLÓMÐMà�:‰:�f˜dÓ#€Dà�j‰j˜ BÓ'€GØ�‚{ÜÐ<Ó=Ð=à�Z‰Z˜ #Ó&€FáÜÐ.´°V³Ñ<Ó=Ð=ä�T˜3 ¨°´yÀ#ÓFÐFr"   N)Úbinasciir   ÚCrypto.Util.py3compatr   r   r   ÚCrypto.Randomr   r*   r	   r
   r   r   r   Úobjectr   r1   r<   r"   r    ú<module>rM      s1   ðõ> ç 9Ñ 9Ý *ç !ß ;Ñ ;ôc�ô cóL%Gr"   