
    ¿ig                     j    d dl mZ d dlmZmZmZmZmZmZm	Z	m
Z
 d dlmZ  G d de          ZddZdS )	    )bord)load_pycryptodome_raw_libVoidPointerSmartPointercreate_string_bufferget_raw_bufferc_size_tc_uint8_ptrc_ubyte)_raw_keccak_libc                   2    e Zd ZdZdZddZd Zd ZddZdS )	SHAKE256_XOFzA SHAKE256 hash object.
    Do not instantiate directly.
    Use the :func:`new` function.

    :ivar oid: ASN.1 Object ID
    :vartype oid: string
    z2.16.840.1.101.3.4.2.12Nc                 ~   t                      }t          j        |                                t	          d          t          d                    }|rt          d|z            t          |                                t          j	                  | _
        d| _        d| _        |r|                     |           d S d S )N@      z%Error %d while instantiating SHAKE256F   )r   r   keccak_init
address_ofr	   r   
ValueErrorr   getkeccak_destroy_state_is_squeezing_paddingupdate)selfdatastateresults       T/var/www/html/afkarena/venv/lib/python3.11/site-packages/Cryptodome/Hash/SHAKE256.py__init__zSHAKE256_XOF.__init__5   s     ,U-=-=-?-?-5b\\-4R[[: :  	'D%& ' ' '"599;;#2#AC C" 	KK	 	    c           	         | j         rt          d          t          j        | j                                        t          |          t          t          |                              }|rt          d|z            | S )zContinue hashing of a message by consuming the next chunk of data.

        Args:
            data (byte string/byte array/memoryview): The next chunk of the message being hashed.
        z/You cannot call 'update' after the first 'read'z&Error %d while updating SHAKE256 state)
r   	TypeErrorr   keccak_absorbr   r   r
   r	   lenr   )r   r   r   s      r    r   zSHAKE256_XOF.updateE   s      	OMNNN .t{/@/@/:4/@/@/7D		/B/BD D  	'E%& ' ' 'r"   c                    d| _         t          |          }t          j        | j                                        |t          |          t          | j                            }|rt          d|z            t          |          S )ah  
        Compute the next piece of XOF output.

        .. note::
            You cannot use :meth:`update` anymore after the first call to
            :meth:`read`.

        Args:
            length (integer): the amount of bytes this method must return

        :return: the next piece of XOF output (of the given length)
        :rtype: byte string
        Tz'Error %d while extracting from SHAKE256)r   r   r   keccak_squeezer   r   r	   r   r   r   r   )r   lengthbfrr   s       r    readzSHAKE256_XOF.readW   s     ""6** /0A0A03080@0@070F0FH H  	'F%& ' ' ' c"""r"   c                 4     t          |           |          S )Nr   )type)r   r   s     r    newzSHAKE256_XOF.newr   s    tDzzt$$$$r"   N)	__name__
__module____qualname____doc__oidr!   r   r+   r/    r"   r    r   r   )   sk          $C      $# # #6% % % % % %r"   r   Nc                 "    t          |           S )a  Return a fresh instance of a SHAKE256 object.

    Args:
       data (bytes/bytearray/memoryview):
        The very first chunk of the message to hash.
        It is equivalent to an early call to :meth:`update`.
        Optional.

    :Return: A :class:`SHAKE256_XOF` object
    r-   )r   r-   s    r    r/   r/   v   s     T""""r"   r0   )Cryptodome.Util.py3compatr   Cryptodome.Util._raw_apir   r   r   r   r   r	   r
   r   Cryptodome.Hash.keccakr   objectr   r/   r6   r"   r    <module>r<      s   > + * * * * *8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3 2 2 2 2 2J% J% J% J% J%6 J% J% J%Z# # # # # #r"   