← Back
Editing: SHAKE256.cpython-311.pyc
� 8�tc0 � �f � d dl mZ d dlmZmZmZmZmZmZm Z d dl mZ G d� de� � Z dd�ZdS ) � )�bord)�load_pycryptodome_raw_lib�VoidPointer�SmartPointer�create_string_buffer�get_raw_buffer�c_size_t�c_uint8_ptr)�_raw_keccak_libc �2 � e Zd ZdZdZdd�Zd� Zd� Zdd�ZdS ) �SHAKE256_XOFz�A SHAKE256 hash object. Do not instantiate directly. Use the :func:`new` function. :ivar oid: ASN.1 Object ID :vartype oid: string z2.16.840.1.101.3.4.2.12Nc �V � t � � }t j |� � � t d� � d� � }|rt d|z � � �t |� � � t j � � | _ d| _ |r| � |� � d S d S )N�@ � z%Error %d while instantiating SHAKE256F)r r �keccak_init� address_ofr � ValueErrorr �get�keccak_destroy�_state� _is_squeezing�update)�self�data�state�results �:/usr/lib/python3/dist-packages/Cryptodome/Hash/SHAKE256.py�__init__zSHAKE256_XOF.__init__5 s� � �� � �� �,�U�-=�-=�-?�-?�-5�b�\�\�-1�3� 3�� � '��D�%�&� '� '� '�"�5�9�9�;�;�#2�#A�C� C���"���� ��K�K������� � � c � � | j rt d� � �t j | j � � � t |� � t t |� � � � � � }|rt d|z � � �| S )z�Continue 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 zSHAKE256_XOF.updateC s� � � �� O��M�N�N�N� �.�t�{���/@�/@�/:�4�/@�/@�/7��D� � �/B�/B�D� D�� � '��E�%�&� '� '� '��r c �� � d| _ t |� � }t j | j � � � |t |� � � � }|rt 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 �length�bfrr s r �readzSHAKE256_XOF.readU s� � � "���"�6�*�*�� �/�����0A�0A�03�08��0@�0@�B� B�� � '��F�%�&� '� '� '� �c�"�"�"r c �4 � t | � � |�� � S )N�r )�type)r r s r �newzSHAKE256_XOF.newo s � ��t�D�z�z�t�$�$�$�$r �N) �__name__� __module__�__qualname__�__doc__�oidr r r( r, � r r r r ) sk � � � � � �� � $�C�� � � �� � �$#� #� #�4%� %� %� %� %� %r r Nc �"