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: //lib/python3/dist-packages/nacl/bindings/__pycache__/crypto_secretbox.cpython-38.pyc
U

�֫[0�@s�ddlmZmZmZddlmZddlmZm	Z	ddl
mZe	��Z
e	��Ze	��Ze	��Ze	��Ze	��Zdd�Zdd�Zd	S)
�)�absolute_import�division�print_function)�
exceptions)�ffi�lib)�ensurecCs�t|�tkrt�d��t|�tkr,t�d��dt|}t�dt|��}t�	||t|�||�}t
|dkdtjd�t�|t|��}|t
d�S)	z�
    Encrypts and returns the message ``message`` with the secret ``key`` and
    the nonce ``nonce``.

    :param message: bytes
    :param nonce: bytes
    :param key: bytes
    :rtype: bytes
    �Invalid key�
Invalid nonce��unsigned char[]rzEncryption failed�ZraisingN)�len�crypto_secretbox_KEYBYTES�exc�
ValueError�crypto_secretbox_NONCEBYTES�crypto_secretbox_ZEROBYTESr�newr�crypto_secretboxr�CryptoError�buffer�crypto_secretbox_BOXZEROBYTES)�message�nonce�key�padded�
ciphertext�res�r�@/usr/lib/python3/dist-packages/nacl/bindings/crypto_secretbox.pyrs


rcCs�t|�tkrt�d��t|�tkr,t�d��dt|}t�dt|��}t�	||t|�||�}t
|dkdtjd�t�|t|��}|t
d�S)	z�
    Decrypt and returns the encrypted message ``ciphertext`` with the secret
    ``key`` and the nonce ``nonce``.

    :param ciphertext: bytes
    :param nonce: bytes
    :param key: bytes
    :rtype: bytes
    r	r
rrrz1Decryption failed. Ciphertext failed verificationr
N)rrrrrrrrr�crypto_secretbox_openrrrr)rrrrZ	plaintextrrrr r!8s$


�
�r!N)Z
__future__rrrZnaclrrZnacl._sodiumrrZnacl.exceptionsrZcrypto_secretbox_keybytesrZcrypto_secretbox_noncebytesrZcrypto_secretbox_zerobytesrZcrypto_secretbox_boxzerobytesrZcrypto_secretbox_macbytesZcrypto_secretbox_MACBYTESZ!crypto_secretbox_messagebytes_maxZ!crypto_secretbox_MESSAGEBYTES_MAXrr!rrrr �<module>s