Your IP : 3.144.37.178


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/__pycache__/keccak.cpython-311.pyc

�

O�Dgw��t�ddlmZddlmZmZmZmZmZmZm	Z	m
Z
edd��ZGd�de��Z
d�ZdS)	���bord)�load_pycryptodome_raw_lib�VoidPointer�SmartPointer�create_string_buffer�get_raw_buffer�c_size_t�c_uint8_ptr�c_ubytezCrypto.Hash._keccaka�
                        int keccak_init(void **state,
                                        size_t capacity_bytes,
                                        uint8_t rounds);
                        int keccak_destroy(void *state);
                        int keccak_absorb(void *state,
                                          const uint8_t *in,
                                          size_t len);
                        int keccak_squeeze(const void *state,
                                           uint8_t *out,
                                           size_t len,
                                           uint8_t padding);
                        int keccak_digest(void *state,
                                          uint8_t *digest,
                                          size_t len,
                                          uint8_t padding);
                        int keccak_copy(const void *src, void *dst);
                        int keccak_reset(void *state);
                        c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�Keccak_Hashz�A Keccak hash object.
    Do not instantiate directly.
    Use the :func:`new` function.

    :ivar digest_size: the size in bytes of the resulting hash
    :vartype digest_size: integer
    c��||_||_d|_d|_t	��}t
�|���t|jdz��td����}|rtd|z���t|���t
j
��|_|r|�|��dSdS)NF���z#Error %d while instantiating keccak)�digest_size�_update_after_digest�_digest_done�_paddingr�_raw_keccak_lib�keccak_init�
address_ofr
r�
ValueErrorr�get�keccak_destroy�_state�update)�self�data�digest_bytes�update_after_digest�state�results      �t/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/keccak.py�__init__zKeccak_Hash.__init__Es���'���$7��!�!�����
��
�
�� �,�,�U�-=�-=�-?�-?�-5�d�6F��6J�-K�-K�-4�R�[�[�:�:���	M��B�V�K�L�L�L�"�5�9�9�;�;�#2�#A�C�C����	��K�K�������	�	�c	��|jr|jstd���t�|j���t|��tt|������}|rtd|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.
        z8You can only call 'digest' or 'hexdigest' on this objectzError %d while updating keccak)rr�	TypeErrorr�
keccak_absorbrrrr
�lenr)rr r$s   r%rzKeccak_Hash.updateXs�����	X�T�%>�	X��V�W�W�W� �.�.�t�{���/@�/@�/:�4�/@�/@�/7��D�	�	�/B�/B�D�D���	H��=��F�G�G�G��r'c�.�d|_t|j��}t�|j���|t|j��t|j	����}|rtd|z���t|��S)z�Return the **binary** (non-printable) digest of the message that has been hashed so far.

        :return: The hash digest, computed over the data processed so far.
                 Binary form.
        :rtype: byte string
        TzError %d while squeezing keccak)rrrr�
keccak_digestrrr
rrrr	)r�bfrr$s   r%�digestzKeccak_Hash.digestis���!���"�4�#3�4�4�� �.�.�t�{���/@�/@�/2�/7��8H�/I�/I�/6�t�}�/E�/E�G�G���	I��>��G�H�H�H��c�"�"�"r'c�d�d�d�|���D����S)z�Return the **printable** digest of the message that has been hashed so far.

        :return: The hash digest, computed over the data processed so far.
                 Hexadecimal encoded.
        :rtype: string
        �c�2�g|]}dt|��z��S)z%02xr)�.0�xs  r%�
<listcomp>z)Keccak_Hash.hexdigest.<locals>.<listcomp>�s#��@�@�@�Q���a���(�@�@�@r')�joinr/)rs r%�	hexdigestzKeccak_Hash.hexdigest|s-���w�w�@�@�$�+�+�-�-�@�@�@�A�A�Ar'c�>�d|vrd|vr
|j|d<tdi|��S)z"Create a fresh Keccak hash object.r!�digest_bits�)r�new)r�kwargss  r%r;zKeccak_Hash.new�s6����'�'�M��,G�,G�%)�%5�F�>�"��}�}�V�}�}�r'N)	�__name__�
__module__�__qualname__�__doc__r&rr/r7r;r:r'r%rr<sl�����������&���"#�#�#�&B�B�B�����r'rc���|�dd��}|�dd��}|�dd��}|�dd��}d||fvrtd���d||fkrtd	���|�|d
vrtd���n|dvrtd
���|dz}|rtdt|��z���t	|||��S)aoCreate a new hash object.

    Args:
        data (bytes/bytearray/memoryview):
            The very first chunk of the message to hash.
            It is equivalent to an early call to :meth:`Keccak_Hash.update`.
        digest_bytes (integer):
            The size of the digest, in bytes (28, 32, 48, 64).
        digest_bits (integer):
            The size of the digest, in bits (224, 256, 384, 512).
        update_after_digest (boolean):
            Whether :meth:`Keccak.digest` can be followed by another
            :meth:`Keccak.update` (default: ``False``).

    :Return: A :class:`Keccak_Hash` hash object
    r Nr"Fr!r9z*Only one digest parameter must be provided)NNz&Digest size (bits, bytes) not provided)�� �0�@z('digest_bytes' must be: 28, 32, 48 or 64)���i�iz,'digest_bytes' must be: 224, 256, 384 or 512�zUnknown parameters: )�popr)r�strr)r<r r"r!r9s     r%r;r;�s��$�:�:�f�d�#�#�D� �*�*�%:�E�B�B���:�:�n�d�3�3�L��*�*�]�D�1�1�K��L�+�.�.�.��D�E�E�E���k�2�2�2��@�A�A�A����/�/�/��G�H�H�H�0��2�2�2��K�L�L�L�"�a�'��
�>��.��V���<�=�=�=��t�\�+>�?�?�?r'N)�Crypto.Util.py3compatr�Crypto.Util._raw_apirrrrr	r
rrr�objectrr;r:r'r%�<module>rNs���>'�&�&�&�&�&�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�,�+�,A�����*P�P�P�P�P�&�P�P�P�f&@�&@�&@�&@�&@r'

?>