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



]jddlmZddlmZmZmZddlmZddlm	Z	ddl
mZmZm
Z
mZmZmZmZeddZGdd	eZd
ZdS))	unhexlify)bordtobytes_copy_bytes)BLAKE2s)get_random_bytes)load_pycryptodome_raw_libVoidPointerSmartPointercreate_string_bufferget_raw_bufferc_size_tc_uint8_ptrzCrypto.Hash._poly1305a
                        int poly1305_init(void **state,
                                          const uint8_t *r,
                                          size_t r_len,
                                          const uint8_t *s,
                                          size_t s_len);
                        int poly1305_destroy(void *state);
                        int poly1305_update(void *state,
                                            const uint8_t *in,
                                            size_t len);
                        int poly1305_digest(const void *state,
                                            uint8_t *digest,
                                            size_t len);
                        c@eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
S)Poly1305_MACzAn Poly1305 MAC object.
    Do not instantiate directly. Use the :func:`new` function.

    :ivar digest_size: the size in bytes of the resulting MAC tag
    :vartype digest_size: integer
    cpt|dkrtdt|dkrtdd|_t}t|t|tt|t|tt|}|rtd|zt|
tj|_|r|
|dSdS)Nrz Parameter r is not 16 bytes longz Parameter s is not 16 bytes longz%Error %d while instantiating Poly1305)len
ValueError_mac_tagr

_raw_poly1305
poly1305_init
address_ofrrrgetpoly1305_destroy_stateupdate)selfrsdatastateresults      v/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/Poly1305.py__init__zPoly1305_MAC.__init__?sq66R<<?@@@q66R<<?@@@


,,U-=-=-?-?-8^^-5c!ff-=-=-8^^-5c!ff-=-=	//	ODvMNNN"599;;#0#ACC	KK		c	|jrtdt|jt
|tt|}|rtd|z|S)zAuthenticate the next chunk of message.

        Args:
            data (byte string/byte array/memoryview): The next chunk of data
        z8You can only call 'digest' or 'hexdigest' on this objectz$Error %d while hashing Poly1305 data)
r	TypeErrorrpoly1305_updaterrrrrr)rr!r#s   r$rzPoly1305_MAC.updateVs=	XVWWW..t{/@/@/:4/@/@/7D		/B/BDD	NCfLMMMr&ct)N)NotImplementedErrorrs r$copyzPoly1305_MAC.copygs!###r&c	4|jr|jStd}t|j|t
t|}|rtd|zt||_|jS)zReturn the **binary** (non-printable) MAC tag of the message
        authenticated so far.

        :return: The MAC tag digest, computed over the data processed so far.
                 Binary form.
        :rtype: byte string
        rz'Error %d while creating Poly1305 digest)
rrrpoly1305_digestrrrrrr
)rbfrr#s   r$digestzPoly1305_MAC.digestjs=	!= "2&&..t{/@/@/2/7C/A/ACC	QFOPPP&s++
}r&c~ddt|DS)zReturn the **printable** MAC tag of the message authenticated so far.

        :return: The MAC tag, computed over the data processed so far.
                 Hexadecimal encoded.
        :rtype: string
        c2g|]}dt|zS)z%02x)r).0xs  r$
<listcomp>z*Poly1305_MAC.hexdigest.<locals>.<listcomp>s3777a(777r&)jointupler1r,s r$	hexdigestzPoly1305_MAC.hexdigestsFww77!&t{{}}!5!577788	8r&ctd}tjd||}tjd||}||krt	ddS)ahVerify that a given **binary** MAC (computed by another party)
        is valid.

        Args:
          mac_tag (byte string/byte string/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_bitskeyr!zMAC check failedN)rrnewr1r)rmac_tagsecretmac1mac2s     r$verifyzPoly1305_MAC.verifysw""%%{sWEEE{sT[[]]KKK;;==DKKMM))/000*)r&cd|tt|dS)a~Verify 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)rDrr)rhex_mac_tags  r$	hexverifyzPoly1305_MAC.hexverifys,	
Igk223344444r&N)__name__
__module____qualname____doc__digest_sizer%rr-r1r:rDrGr&r$rr5sK."$$$,	8	8	8111(
5
5
5
5
5r&rc|dd}t|dstd|dd}|td|dd}|dd}|rtd	t	|z|||\}}}t
|||}tdd||_|S)
aCreate a new Poly1305 MAC object.

    Args:
        key (bytes/bytearray/memoryview):
            The 32-byte key for the Poly1305 object.
        cipher (module from ``Crypto.Cipher``):
            The cipher algorithm to use for deriving the Poly1305
            key pair *(r, s)*.
            It can only be ``Crypto.Cipher.AES`` or ``Crypto.Cipher.ChaCha20``.
        nonce (bytes/bytearray/memoryview):
            Optional. The non-repeatable value to use for the MAC of this message.
            It must be 16 bytes long for ``AES`` and 8 or 12 bytes for ``ChaCha20``.
            If not passed, a random nonce is created; you will find it in the
            ``nonce`` attribute of the new object.
        data (bytes/bytearray/memoryview):
            Optional. The very first chunk of the message to authenticate.
            It is equivalent to an early call to ``update()``.

    Returns:
        A :class:`Poly1305_MAC` object
    cipherN_derive_Poly1305_key_pairz*Parameter 'cipher' must be AES or ChaCha20r>zYou must pass a parameter 'key'noncer!zUnknown parameters: )	pophasattrrr(strrPrrrQ)kwargsrO
cipher_keyrQr!rr new_macs        r$r?r?s.ZZ$
'
'F6677GEFFFE4((J9:::JJw%%E::fd##D
>.V<===22:uEEKAq%1a&&GdE22GMNr&N)binasciirCrypto.Util.py3compatrrrCrypto.Hashr
Crypto.RandomrCrypto.Util._raw_apir	r
rrr
rrrobjectrr?rMr&r$<module>r^s.<<<<<<<<<<******//////////////////*)*A

"w5w5w5w5w56w5w5w5v)))))r&
Back to Directory File Manager