
    ¿ig                     X    d dl mZmZmZ ddlmZ ddlmZmZ  G d de          Z	d Z
dS )	    )bordis_bytestobytes   )	cSHAKE128)_encode_str_right_encodec                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )	TupleHashz\A Tuple hash object.
    Do not instantiate directly.
    Use the :func:`new` function.
    c                 Z    || _         |                    d|d          | _        d | _        d S )N    s	   TupleHash)digest_size_new_cshake_digest)selfcustomcshaker   s       X/var/www/html/afkarena/venv/lib/python3.11/site-packages/Cryptodome/Hash/TupleHash128.py__init__zTupleHash.__init__+   s,    &{{3==r   c                     | j         t          d          |D ]G}t          |          st          d          | j                            t          |                     H| S )zAuthenticate the next tuple of byte strings.
        TupleHash guarantees the logical separation between each byte string.

        Args:
            data (bytes/bytearray/memoryview): One or more items to hash.
        Nz6You cannot call 'update' after 'digest' or 'hexdigest'z#You can only call 'update' on bytes)r   	TypeErrorr   r   updater   )r   dataitems      r   r   zTupleHash.update2   sn     <#TUUU 	3 	3DD>> H EGGGLD 1 12222r   c                     | j         S| j                            t          | j        dz                       | j                            | j                  | _         | j         S )zReturn the **binary** (non-printable) digest of the tuple of byte strings.

        :return: The hash digest. Binary form.
        :rtype: byte string
        N   )r   r   r   r	   r   readr   s    r   digestzTupleHash.digestD   sT     <Ld.>.B C CDDD<,,T-=>>DL|r   c                 ~    d                     d t          |                                           D                       S )zReturn the **printable** digest of the tuple of byte strings.

        :return: The hash digest. Hexadecimal encoded.
        :rtype: string
         c                 2    g | ]}d t          |          z  S )z%02x)r   ).0xs     r   
<listcomp>z'TupleHash.hexdigest.<locals>.<listcomp>X   s#    GGGQa(GGGr   )jointupler    r   s    r   	hexdigestzTupleHash.hexdigestQ   s5     wwGG%2F2FGGGHHHr   c                 >    d|vrd|vr
| j         |d<   t          di |S )zNReturn a new instance of a TupleHash object.
        See :func:`new`.
        digest_bytesdigest_bits )r   new)r   kwargss     r   r.   zTupleHash.newZ   s6    
 ''M,G,G%)%5F>"}}V}}r   N)	__name__
__module____qualname____doc__r   r   r    r)   r.   r-   r   r   r   r   %   sl         
    $  I I I    r   r   c                  ^   |                      dd          }|                      dd          }d||fvrt          d          d||fk    rd}||dk     rt          d          n|dk     s|dz  rt          d	          |dz  }|                      d
d          }t          |t          |          S )a  Create a new TupleHash128 object.

    Args:
       digest_bytes (integer):
        Optional. The size of the digest, in bytes.
        Default is 64. Minimum is 8.
       digest_bits (integer):
        Optional and alternative to ``digest_bytes``.
        The size of the digest, in bits (and in steps of 8).
        Default is 512. Minimum is 64.
       custom (bytes):
        Optional.
        A customization bytestring (``S`` in SP 800-185).

    :Return: A :class:`TupleHash` object
    r+   Nr,   z*Only one digest parameter must be provided)NN@   r   z!'digest_bytes' must be at least 8z0'digest_bytes' must be at least 64 in steps of 8r   r   )popr   
ValueErrorr   r   )r/   r+   r,   r   s       r   r.   r.   e   s    $ ::nd33L**]D11KL+...DEEEk222!@AAA  {Q - . . ."a'ZZ#&&FVY555r   N)Cryptodome.Util.py3compatr   r   r   r"   r   r   r	   objectr   r.   r-   r   r   <module>r:      s   > > = = = = = = = = =       1 1 1 1 1 1 1 1= = = = = = = =@#6 #6 #6 #6 #6r   