HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/lib/python3/dist-packages/nacl/bindings/__pycache__/crypto_aead.cpython-38.pyc
U

�֫[�C�@sddlmZmZmZddlmZddlmZm	Z	ddl
mZe	��Z
e	��Ze	��Ze	��Ze	��ZeeZe	��Ze	��Ze	��Ze	��Ze	��Z e eZ!e	�"�Z#e	�$�Z%e	�&�Z'e	�(�Z)e	�*�Z+e+e)Z,dd�Z-dd�Z.d	d
�Z/dd�Z0d
d�Z1dd�Z2dS)�)�absolute_import�division�print_function)�
exceptions)�ffi�lib)�ensurecCs(tt|t�dtjd�t|�}t|tkd�t�tjd�tt|t�pJ|dkdtjd�tt|t�olt|�t	kd�t	�tjd�tt|t�o�t|�t
kd�t
�tjd�|r�|}t|�}n
tj}d}|t
}t�d	�}t�d
|�}	t�|	|||||tj||�	}
t|
dkdtjd�t�|	|d�dd�S)aP
    Encrypt the given ``message`` using the IETF ratified chacha20poly1305
    construction described in RFC7539.

    :param message:
    :type message: bytes
    :param aad:
    :type aad: bytes
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: authenticated ciphertext
    :rtype: bytes
    � Input message type must be bytes�Zraising�&Message must be at most {0} bytes longN�%Additional data must be bytes or None�-Nonce must be a {0} bytes long bytes sequence�+Key must be a {0} bytes long bytes sequencer�unsigned long long *�unsigned char[]�Encryption failed.)r�
isinstance�bytes�exc�	TypeError�len�2crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX�format�
ValueError�+crypto_aead_chacha20poly1305_ietf_NPUBBYTES�*crypto_aead_chacha20poly1305_ietf_KEYBYTESr�NULL�(crypto_aead_chacha20poly1305_ietf_ABYTES�newr�)crypto_aead_chacha20poly1305_ietf_encrypt�CryptoError�buffer��message�aad�nonce�key�mlen�_aad�aalen�mxout�clen�
ciphertext�res�r.�;/usr/lib/python3/dist-packages/nacl/bindings/crypto_aead.pyrFs`����
��
��

�
rcCs(tt|t�dtjd�t|�}t|tkd�t�tjd�tt|t�pJ|dkdtjd�tt|t�olt|�t	kd�t	�tjd�tt|t�o�t|�t
kd�t
�tjd�|t}t�
d�}t�
d	|�}|r�|}t|�}	n
tj}d
}	t�||tj||||	||�	}
t|
d
kdtjd�t�||d
�dd�S)aH
    Decrypt the given ``ciphertext`` using the IETF ratified chacha20poly1305
    construction described in RFC7539.

    :param ciphertext:
    :type ciphertext: bytes
    :param aad:
    :type aad: bytes
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: message
    :rtype: bytes
    �#Input ciphertext type must be bytesr
�)Ciphertext must be at most {0} bytes longNrr
rrrr�Decryption failed.)rrrrrr�*_aead_chacha20poly1305_ietf_CRYPTBYTES_MAXrrrrrrrrr�)crypto_aead_chacha20poly1305_ietf_decryptr r!�r,r$r%r&r+r*r'r#r(r)r-r.r.r/r4�sb
����
��
��

�
r4cCs0tt|t�dtjd�t|�}t|tkd�t�tjd�tt|t�pJ|dkdtjd�tt|t�olt|�t	kd�t	�tjd�tt|t�o�t|�t
kd�t
�tjd�|r�|}t|�}n
tj}d}t|�}|t
}t�d	�}t�d
|�}	t�|	|||||tj||�	}
t|
dkdtjd�t�|	|d�dd�S)aQ
    Encrypt the given ``message`` using the "legacy" construction
    described in draft-agl-tls-chacha20poly1305.

    :param message:
    :type message: bytes
    :param aad:
    :type aad: bytes
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: authenticated ciphertext
    :rtype: bytes
    r	r
rNrr
rrrrr)rrrrrr�-crypto_aead_chacha20poly1305_MESSAGEBYTES_MAXrr�&crypto_aead_chacha20poly1305_NPUBBYTES�%crypto_aead_chacha20poly1305_KEYBYTESrrrrr�$crypto_aead_chacha20poly1305_encryptr r!r"r.r.r/r9�sb����
��
��

�
r9cCs(tt|t�dtjd�t|�}t|tkd�t�tjd�tt|t�pJ|dkdtjd�tt|t�olt|�t	kd�t	�tjd�tt|t�o�t|�t
kd�t
�tjd�|t}t�
d�}t�
d	|�}|r�|}t|�}	n
tj}d
}	t�||tj||||	||�	}
t|
d
kdtjd�t�||d
�dd�S)ab
    Decrypt the given ``ciphertext`` using the "legacy" construction
    described in draft-agl-tls-chacha20poly1305.

    :param ciphertext: authenticated ciphertext
    :type ciphertext: bytes
    :param aad:
    :type aad: bytes
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: message
    :rtype: bytes
    r0r
r1Nrr
rrrrr2)rrrrrr�%_aead_chacha20poly1305_CRYPTBYTES_MAXrrr7r8�#crypto_aead_chacha20poly1305_ABYTESrrrr�$crypto_aead_chacha20poly1305_decryptr r!r5r.r.r/r<sb
����
��
��

�
r<cCs0tt|t�dtjd�t|�}t|tkd�t�tjd�tt|t�pJ|dkdtjd�tt|t�olt|�t	kd�t	�tjd�tt|t�o�t|�t
kd�t
�tjd�|r�|}t|�}n
tj}d}t|�}|t
}t�d	�}t�d
|�}	t�|	|||||tj||�	}
t|
dkdtjd�t�|	|d�dd�S)a:
    Encrypt the given ``message`` using the long-nonces xchacha20poly1305
    construction.

    :param message:
    :type message: bytes
    :param aad:
    :type aad: bytes
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: authenticated ciphertext
    :rtype: bytes
    r	r
rNrr
rrrrr)rrrrrr�3crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAXrr�,crypto_aead_xchacha20poly1305_ietf_NPUBBYTES�+crypto_aead_xchacha20poly1305_ietf_KEYBYTESrr�)crypto_aead_xchacha20poly1305_ietf_ABYTESrr�*crypto_aead_xchacha20poly1305_ietf_encryptr r!r"r.r.r/rA]sb����
��
��

�
rAcCs(tt|t�dtjd�t|�}t|tkd�t�tjd�tt|t�pJ|dkdtjd�tt|t�olt|�t	kd�t	�tjd�tt|t�o�t|�t
kd�t
�tjd�|t}t�
d�}t�
d	|�}|r�|}t|�}	n
tj}d
}	t�||tj||||	||�	}
t|
d
kdtjd�t�||d
�dd�S)aK
    Decrypt the given ``ciphertext`` using the long-nonces xchacha20poly1305
    construction.

    :param ciphertext: authenticated ciphertext
    :type ciphertext: bytes
    :param aad:
    :type aad: bytes
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: message
    :rtype: bytes
    r0r
r1Nrr
rrrrr2)rrrrrr�+_aead_xchacha20poly1305_ietf_CRYPTBYTES_MAXrrr>r?r@rrrr�*crypto_aead_xchacha20poly1305_ietf_decryptr r!r5r.r.r/rC�sb
����
��
��

�
rCN)3Z
__future__rrrZnaclrrZnacl._sodiumrrZnacl.exceptionsrZ*crypto_aead_chacha20poly1305_ietf_keybytesrZ+crypto_aead_chacha20poly1305_ietf_nsecbytesZ+crypto_aead_chacha20poly1305_ietf_NSECBYTESZ+crypto_aead_chacha20poly1305_ietf_npubbytesrZ(crypto_aead_chacha20poly1305_ietf_abytesrZ2crypto_aead_chacha20poly1305_ietf_messagebytes_maxrr3Z%crypto_aead_chacha20poly1305_keybytesr8Z&crypto_aead_chacha20poly1305_nsecbytesZ&crypto_aead_chacha20poly1305_NSECBYTESZ&crypto_aead_chacha20poly1305_npubbytesr7Z#crypto_aead_chacha20poly1305_abytesr;Z-crypto_aead_chacha20poly1305_messagebytes_maxr6r:Z+crypto_aead_xchacha20poly1305_ietf_keybytesr?Z,crypto_aead_xchacha20poly1305_ietf_nsecbytesZ,crypto_aead_xchacha20poly1305_ietf_NSECBYTESZ,crypto_aead_xchacha20poly1305_ietf_npubbytesr>Z)crypto_aead_xchacha20poly1305_ietf_abytesr@Z3crypto_aead_xchacha20poly1305_ietf_messagebytes_maxr=rBrr4r9r<rArCr.r.r.r/�<module>sf	���������������������EFFFF