
    i                     d    S SK Jr  S SKJrJrJrJrJrJrJ	r	J
r
  S SKJr   " S S\5      rSS jrg)	    )bord)load_pycryptodome_raw_libVoidPointerSmartPointercreate_string_bufferget_raw_bufferc_size_tc_uint8_ptrc_ubyte)_raw_keccak_libc                   B    \ rS rSrSrSrSS jrS rS rS r	SS	 jr
S
rg)SHAKE128_XOF)   zA SHAKE128 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.11Nc                 Z   [        5       n[        R                  " UR                  5       [	        S5      [        S5      5      nU(       a  [        SU-  5      e[        UR                  5       [        R                  5      U l
        SU l        SU l        U(       a  U R                  U5        g g )N       z%Error %d while instantiating SHAKE128F   )r   r   keccak_init
address_ofr	   r   
ValueErrorr   getkeccak_destroy_state_is_squeezing_paddingupdate)selfdatastateresults       O/var/www/html/trading/venv/lib/python3.13/site-packages/Crypto/Hash/SHAKE128.py__init__SHAKE128_XOF.__init__5   s     ,,U-=-=-?-5b\-4R[: D%& ' '"599;#2#A#AC"KK     c           	          U R                   (       a  [        S5      e[        R                  " U R                  R                  5       [        U5      [        [        U5      5      5      nU(       a  [        SU-  5      eU $ )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 SHAKE128 state)
r   	TypeErrorr   keccak_absorbr   r   r
   r	   lenr   )r   r   r    s      r!   r   SHAKE128_XOF.updateD   sm     MNN ..t{{/@/:4/@/7D	/BD E%& ' 'r$   c                     SU l         [        U5      n[        R                  " U R                  R                  5       U[        U5      [        U R                  5      5      nU(       a  [        SU-  5      e[        U5      $ )a   
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 SHAKE128)r   r   r   keccak_squeezer   r   r	   r   r   r   r   )r   lengthbfrr    s       r!   readSHAKE128_XOF.readV   su     ""6* //0A03080@070FH F%& ' ' c""r$   c                     U R                  5       n[        R                  " U R                  R	                  5       UR                  R	                  5       5      nU(       a  [        SU-  5      eU$ )zReturn a copy ("clone") of the hash object.

The copy will have the same internal state as the original hash
object.

:return: A hash object of the same type
zError %d while copying SHAKE128)newr   keccak_copyr   r   r   )r   cloner    s      r!   copySHAKE128_XOF.copyq   sV     
 ,,T[[__->-2\\-=-=-?A>GHHr$   c                      [        U 5      " US9$ )Nr   )type)r   r   s     r!   r1   SHAKE128_XOF.new   s    Dzt$$r$   )r   r   r   N)__name__
__module____qualname____firstlineno____doc__oidr"   r   r.   r4   r1   __static_attributes__ r$   r!   r   r   )   s'     $C$#6 %r$   r   Nc                     [        U S9$ )zReturn a fresh instance of a SHAKE128 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:`SHAKE128_XOF` object
r7   )r   r7   s    r!   r1   r1      s     T""r$   r:   )Crypto.Util.py3compatr   Crypto.Util._raw_apir   r   r   r   r   r	   r
   r   Crypto.Hash.keccakr   objectr   r1   rB   r$   r!   <module>rH      s2   > '8 8 8 /Y%6 Y%x#r$   