Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/Crypto/Hash/__pycache__/BLAKE2s.cpython-311.pyc



]j$ddlmZddlmZmZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZeddZGddeZd	Zd
S))	unhexlify)bordtobytes)get_random_bytes)load_pycryptodome_raw_libVoidPointerSmartPointercreate_string_bufferget_raw_bufferc_size_tc_uint8_ptrzCrypto.Hash._BLAKE2sa
                        int blake2s_init(void **state,
                                         const uint8_t *key,
                                         size_t key_size,
                                         size_t digest_size);
                        int blake2s_destroy(void *state);
                        int blake2s_update(void *state,
                                           const uint8_t *buf,
                                           size_t len);
                        int blake2s_digest(const void *state,
                                           uint8_t digest[32]);
                        int blake2s_copy(const void *src, void *dst);
                        c@eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
S)BLAKE2s_HashaA BLAKE2s hash object.
    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|_|dvr|sdt|z|_t}t|t|tt|t|}|rtd|zt|tj|_|r||dSdS)NF)rz1.3.6.1.4.1.1722.12.2.2.z$Error %d while instantiating BLAKE2s)digest_size_update_after_digest_digest_donestroidr_raw_blake2s_libblake2s_init
address_ofr
rlen
ValueErrorr	getblake2s_destroy_stateupdate)selfdatakeydigest_bytesupdate_after_digeststateresults       u/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/BLAKE2s.py__init__zBLAKE2s_Hash.__init__Ls($7!!+++C+1C4E4EEDH

!..u/?/?/A/A/:3/?/?/7C/A/A/7/E/E11
	NCfLMMM"599;;#3#CEE	KK		c	|jr|jstdt|jt|tt|}|rtd|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.
        z8You can only call 'digest' or 'hexdigest' on this objectz#Error %d while hashing BLAKE2s data)rr	TypeErrorrblake2s_updater!rr
rrr)r#r$r)s   r*r"zBLAKE2s_Hash.updatefs	XT%>	XVWWW!001B1B1<T1B1B19#d))1D1DFF	MBVKLLLr,ctd}t|j|}|rtd|zd|_t|d|jS)zReturn 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
        rz&Error %d while creating BLAKE2s digestTN)	r
rblake2s_digestr!rrrrr)r#bfrr)s   r*digestzBLAKE2s_Hash.digestxsx#2&&!001B1B1466	PENOOO c""#4D$4#455r,c~ddt|DS)zReturn 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
        c2g|]}dt|zS)z%02x)r).0xs  r*
<listcomp>z*BLAKE2s_Hash.hexdigest.<locals>.<listcomp>s#GGGQa(GGGr,)jointupler3)r#s r*	hexdigestzBLAKE2s_Hash.hexdigests5wwGG%

2F2FGGGHHHr,ctd}td||}td||}||krtddS)agVerify that a given **binary** MAC (computed by another party)
        is valid.

        Args:
          mac_tag (byte string/byte array/memoryview): the expected MAC of the message.

        Raises:
            ValueError: if the MAC does not match. It means that the message
                has been tampered with or that the MAC key is incorrect.
        r)digest_bitsr%r$zMAC check failedN)rnewr3r)r#mac_tagsecretmac1mac2s     r*verifyzBLAKE2s_Hash.verifyss""%%sW===sT[[]]CCC;;==DKKMM))/000*)r,cd|tt|dS)anVerify that a given **printable** MAC (computed by another party)
        is valid.

        Args:
            hex_mac_tag (string): the expected MAC of the message, as a hexadecimal string.

        Raises:
            ValueError: if the MAC does not match. It means that the message
                has been tampered with or that the MAC key is incorrect.
        N)rErr)r#hex_mac_tags  r*	hexverifyzBLAKE2s_Hash.hexverifys,	
Igk223344444r,c>d|vrd|vr
|j|d<tdi|S)zQReturn a new instance of a BLAKE2s hash object.
        See :func:`new`.
        r&r?)rr@)r#kwargss  r*r@zBLAKE2s_Hash.news6
''M,G,G%)%5F>"}}V}}r,N)__name__
__module____qualname____doc__
block_sizer+r"r3r<rErHr@rJr,r*rr:sJ4$666&III111*555r,rcZ|dd}|dd}|dd}|dd}d||fvrtdd||fkrd	}|d
|cxkrd	ksntdn)d|cxkrd
krnn|dzrtd|dz}|dd}t|d	krtd|rtdt	|zt||||S)aCreate a new hash object.

    Args:
        data (byte string/byte array/memoryview):
            Optional. The very first chunk of the message to hash.
            It is equivalent to an early call to :meth:`BLAKE2s_Hash.update`.
        digest_bytes (integer):
            Optional. The size of the digest, in bytes (1 to 32). Default is 32.
        digest_bits (integer):
            Optional and alternative to ``digest_bytes``.
            The size of the digest, in bits (8 to 256, in steps of 8).
            Default is 256.
        key (byte string):
            Optional. The key to use to compute the MAC (1 to 64 bytes).
            If not specified, no key will be used.
        update_after_digest (boolean):
            Optional. By default, a hash object cannot be updated anymore after
            the digest is computed. When this flag is ``True``, such check
            is no longer enforced.

    Returns:
        A :class:`BLAKE2s_Hash` hash object
    r$Nr'Fr&r?z*Only one digest parameter must be provided)NNrz!'digest_bytes' not in range 1..32z2'digest_bits' not in range 8..256, with steps of 8r%r,z"BLAKE2s key cannot exceed 32 byteszUnknown parameters: )popr.rrrr)rKr$r'r&r?r%s      r*r@r@su2::fd##D **%:EBB::nd33L**]D11KL+...DEEEk222\''''R''''@AAA([''''C'''''[1_'/00
0"a'
**UC
 
 C
3xx"}}=>>>
>.V<===c<1DEEEr,N)binasciirCrypto.Util.py3compatrr
Crypto.RandomrCrypto.Util._raw_apirrr	r
rrr
robjectrr@rJr,r*<module>r[s>////////******//////////////////-,-C

 HHHHH6HHHV2F2F2F2F2Fr,
Back to Directory File Manager