§
    ‹r°d=  ã                   óx   — 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d
S )é    )Ú	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
d	S )
Ú	KMAC_Hashz[A KMAC hash object.
    Do not instantiate directly.
    Use the :func:`new` function.
    c                 óþ   — d|z   | _         || _        d | _        t          t	          t          |¦  «        ¦  «        |¦  «        }|                     ||d¦  «        | _        |r| j                             |¦  «         d S d S )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	            úX/var/www/pp.vulcan-creative.com/venv/lib/python3.11/site-packages/Crypto/Hash/KMAC128.pyÚ__init__zKMAC_Hash.__init__.   s�   € ð +¨[Ñ8ˆŒØ"ˆÔàˆŒ	å¥­G°C©L¬LÑ 9Ô 9¸4Ñ@Ô@ˆØ—{’{ <°¸ÑAÔAˆŒàð 	&ØŒL×Ò Ñ%Ô%Ð%Ð%Ð%ð	&ð 	&ó    c                 óf   — | j         rt          d¦  «        ‚| 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=   s9   € ð Œ9ð 	XÝÐVÑWÔWÐWàŒ×Ò˜DÑ!Ô!Ð!Øˆr"   c                 óÄ   — | j         sS| j                             t          | j        dz  ¦  «        ¦  «         | 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   sV   € ð Œ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 | ]}d t          |¦  «        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    Ú	hexdigestzKMAC_Hash.hexdigestX   s5   € ð �wŠwÐGÐGµ%¸¿º¹¼Ñ2FÔ2FÐGÑGÔGÑHÔHÐHr"   c                 ó  — t          d¦  «        }t          j        ||z   ¦  «        }t          j        ||                      ¦   «         z   ¦  «        }|                     ¦   «         |                     ¦   «         k    rt	          d¦  «        ‚dS )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   ss   € õ " "Ñ%Ô%ˆåŒ|˜F WÑ,Ñ-Ô-ˆÝŒ|˜F T§[¢[¡]¤]Ñ2Ñ3Ô3ˆà�;Š;‰=Œ=˜DŸKšK™MœMÒ)Ð)ÝÐ/Ñ0Ô0Ð0ð *Ð)r"   c                 ód   — |                       t          t          |¦  «        ¦  «        ¦  «         dS )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)r;   r   r   )r   Úhex_mac_tags     r    Ú	hexverifyzKMAC_Hash.hexverifyu   s,   € ð 	�Š•I�g kÑ2Ô2Ñ3Ô3Ñ4Ô4Ð4Ð4Ð4r"   c                 ó6   — d|vr
| j         |d<   t          di |¤ŽS )zNReturn a new instance of a KMAC hash object.
        See :func:`new`.
        r   © )r   r5   )r   Úkwargss     r    r5   zKMAC_Hash.newƒ   s,   € ð
 ˜FÐ"Ð"Ø $Ô 0ˆF�9Ñåˆ}ˆ}�Vˆ}ˆ}Ðr"   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   r   r)   r2   r;   r>   r5   r@   r"   r    r   r   (   sŠ   € € € € € ðð ð
&ð &ð &ðð ð ðð ð ðIð Ið Ið1ð 1ð 1ð(5ð 5ð 5ðð ð ð ð r"   r   c            	      óÒ  — |                       dd¦  «        }t          |¦  «        st          d¦  «        ‚t          |¦  «        dk     rt	          d¦  «        ‚|                       dd¦  «        }|                       dd¦  «        }|d	k     rt	          d
¦  «        ‚|                       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 KMAC128r4   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$   Úlenr6   Ústrr   r	   )rA   r   r   r   r   s        r    r5   r5   Ž   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.py3compatr   r   r   ÚCrypto.Randomr   r+   r	   r
   r   r   r   Úobjectr   r5   r@   r"   r    ú<module>rQ      sÐ   ðð> Ð Ð Ð Ð Ð à 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø *Ð *Ð *Ð *Ð *Ð *à !Ð !Ð !Ð !Ð !Ð !Ð !Ð !Ø ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;ðcð cð cð cð c�ñ cô cð cðL%Gð %Gð %Gð %Gð %Gr"   