ok

Mini Shell

Direktori : /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__/SHA512.cpython-311.pyc

�

1�Dg(���ddlmZddlmZmZmZmZmZmZm	Z	edd��Z
Gd�de��Zdd�Z
d	Zd
Zd�ZdS)
���bord)�load_pycryptodome_raw_lib�VoidPointer�SmartPointer�create_string_buffer�get_raw_buffer�c_size_t�c_uint8_ptrzCrypto.Hash._SHA512a
                        int SHA512_init(void **shaState,
                                        size_t digest_size);
                        int SHA512_destroy(void *shaState);
                        int SHA512_update(void *hs,
                                          const uint8_t *buf,
                                          size_t len);
                        int SHA512_digest(const void *shaState,
                                          uint8_t *digest,
                                          size_t digest_size);
                        int SHA512_copy(const void *src, void *dst);

                        int SHA512_pbkdf2_hmac_assist(const void *inner,
                                            const void *outer,
                                            const uint8_t *first_digest,
                                            uint8_t *final_digest,
                                            size_t iterations,
                                            size_t digest_size);
                        c�<�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d
d	�Z
dS)�
SHA512Hasha�A SHA-512 hash object (possibly in its truncated version SHA-512/224 or
    SHA-512/256.
    Do not instantiate directly. Use the :func:`new` function.

    :ivar oid: ASN.1 Object ID
    :vartype oid: string

    :ivar block_size: the size in bytes of the internal message block,
                      input to the compression function
    :vartype block_size: integer

    :ivar digest_size: the size in bytes of the resulting hash
    :vartype digest_size: integer
    �c��||_|�d|_d|_n9|dkrd|_d|_n$|dkrd|_d|_ntd	���t	��}t
�|���t|j����}|rtd
|z���t|�
��t
j��|_|r|�
|��dSdS)Nz2.16.840.1.101.3.4.2.3�@�224z2.16.840.1.101.3.4.2.5��256z2.16.840.1.101.3.4.2.6� z7Incorrect truncation length. It must be '224' or '256'.z$Error %d while instantiating SHA-512)�	_truncate�oid�digest_size�
ValueErrorr�_raw_sha512_lib�SHA512_init�
address_ofr
r�get�SHA512_destroy�_state�update)�self�data�truncate�state�results     �t/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/SHA512.py�__init__zSHA512Hash.__init__Es��!�����/�D�H�!�D���
��
�
�/�D�H�!�D���
��
�
�/�D�H�!�D����V�W�W�W��
�
�� �,�,�U�-=�-=�-?�-?�-5�d�6F�-G�-G�I�I���	'��C�%�&�'�'�
'�"�5�9�9�;�;�#2�#A�C�C����	��K�K�������	�	�c	���t�|j���t	|��tt
|������}|rtd|z���dS)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'Error %d while hashing data with SHA512N)r�
SHA512_updaterrrr
�lenr)r r!r$s   r%rzSHA512Hash.update_sv��!�.�.�t�{���/@�/@�/:�4�/@�/@�/7��D�	�	�/B�/B�D�D���	'��F�%�&�'�'�
'�	'�	'r'c��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
        z#Error %d while making SHA512 digest)	rrr�
SHA512_digestrrr
rr	)r �bfrr$s   r%�digestzSHA512Hash.digestms���#�4�#3�4�4�� �.�.�t�{���/@�/@�/2�/7��8H�/I�/I�K�K���	'��B�%�&�'�'�
'��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(SHA512Hash.hexdigest.<locals>.<listcomp>�s#��@�@�@�Q���a���(�@�@�@r')�joinr.)r s r%�	hexdigestzSHA512Hash.hexdigests-���w�w�@�@�$�+�+�-�-�@�@�@�A�A�Ar'c���td|j��}t�|j���|j�����}|rt
d|z���|S)a4Return a copy ("clone") of the hash object.

        The copy will have the same internal state as the original hash
        object.
        This can be used to efficiently compute the digests of strings that
        share a common initial substring.

        :return: A hash object of the same type
        NzError %d while copying SHA512)r
rr�SHA512_copyrrr)r �cloner$s   r%�copyzSHA512Hash.copy�sm���4���0�0�� �,�,�T�[�_�_�->�->�-2�\�-=�-=�-?�-?�A�A���	G��<�v�E�F�F�F��r'Nc�,�t||j��S)z#Create a fresh SHA-512 hash object.)r
r)r r!s  r%�newzSHA512Hash.new�s���$���/�/�/r')N)�__name__�
__module__�__qualname__�__doc__�
block_sizer&rr.r6r:r<�r'r%r
r
2s�������
�
� �J����4'�'�'�#�#�#�$B�B�B����$0�0�0�0�0�0r'r
Nc�"�t||��S)aCreate a new hash object.

    Args:
      data (bytes/bytearray/memoryview):
        Optional. The very first chunk of the message to hash.
        It is equivalent to an early call to :meth:`SHA512Hash.update`.
      truncate (string):
        Optional. The desired length of the digest. It can be either "224" or
        "256". If not present, the digest is 512 bits long.
        Passing this parameter is **not** equivalent to simply truncating
        the output digest.

    :Return: A :class:`SHA512Hash` hash object
    )r
)r!r"s  r%r<r<�s�� �d�H�%�%�%r'rrc�x�|dksJ�tt|����}t�|j���|j���||t
|��t
t|������}|rtd|z���t|��S)z/Compute the expensive inner loop in PBKDF-HMAC.rz+Error %d with PBKDF2-HMAC assist for SHA512)	rr*r�SHA512_pbkdf2_hmac_assistrrr
rr	)�inner�outer�first_digest�
iterationsr-r$s      r%�_pbkdf2_hmac_assistrJ�s�����>�>�>�>�
�s�<�0�0�
1�
1�C�
�
6�
6��L�$�$�&�&��L�$�$�&�&� ���Z�(�(��S��.�.�/�/�
1�1�F��Q��F��O�P�P�P��#���r')NN)�Crypto.Util.py3compatr�Crypto.Util._raw_apirrrrr	r
rr�objectr
r<rrArJrBr'r%�<module>rNs���*'�&�&�&�&�&�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�,�+�,A�����*l0�l0�l0�l0�l0��l0�l0�l0�^&�&�&�&�(���
�����r'

Zerion Mini Shell 1.0