
    ,h                     P    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
y)	    )bordis_bytestobytes   )	cSHAKE128)_encode_str_right_encodec                   .    e Zd ZdZd Zd Zd Zd Zd Zy)	TupleHashz\A Tuple hash object.
    Do not instantiate directly.
    Use the :func:`new` function.
    c                 P    || _         |j                  d|d      | _        d | _        y )N    s	   TupleHash)digest_size_new_cshake_digest)selfcustomcshaker   s       Z/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/Crypto/Hash/TupleHash128.py__init__zTupleHash.__init__+   s%    &{{3=r   c                     | j                   t        d      |D ]<  }t        |      st        d      | j                  j	                  t        |             > | 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.
        z6You 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   sZ     <<#TUU 	3DD> EGGLLD 12	3
 r   c                     | j                   [| j                  j                  t        | j                  dz               | j                  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
           )r   r   r   r	   r   read)r   s    r   digestzTupleHash.digestD   sV     <<LLd.>.>.B CD<<,,T-=-=>DL||r   c           	          dj                  t        | j                               D cg c]  }dt        |      z   c}      S c c}w )zReturn the **printable** digest of the tuple of byte strings.

        :return: The hash digest. Hexadecimal encoded.
        :rtype: string
         z%02x)jointupler   r   )r   xs     r   	hexdigestzTupleHash.hexdigestQ   s5     ww%2FGQa(GHHGs   Ac                 F    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   s/    
 'M,G%)%5%5F>"}V}r   N)	__name__
__module____qualname____doc__r   r   r   r%   r*   r)   r   r   r   r   %   s!    
$Ir   r   c                     | j                  dd      }| j                  dd      }d||fvrt        d      d||fk(  rd}||dk  r%t        d      |dk  s|dz  rt        d	      |dz  }| j                  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3L**]D1KL+..DEEk22!@AA{Q - . ."a'ZZ#&FVY55r   N)Crypto.Util.py3compatr   r   r   r!   r   r   r	   objectr   r*   r)   r   r   <module>r6      s%   > : 9  1= =@#6r   