403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.216.115
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/Cryptodome/Cipher/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/Cryptodome/Cipher/__pycache__/ChaCha20_Poly1305.cpython-311.pyc
�

8�tc)-���ddlmZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZmZddlmZd	�Zed
dd�
��ZGd�de��Zd�ZdZdS)�)�	unhexlify)�ChaCha20)�
_HChaCha20)�Poly1305�BLAKE2s)�get_random_bytes)�
long_to_bytes)�_copy_bytes�bord)�	is_bufferc�$�tdd|��S)N�Enum�)�type)�enumss �E/usr/lib/python3/dist-packages/Cryptodome/Cipher/ChaCha20_Poly1305.py�_enumr,s�����E�"�"�"����)�PROCESSING_AUTH_DATA�PROCESSING_CIPHERTEXT�PROCESSING_DONEc�^�eZdZdZd�Zd�Zd�Zdd�Zdd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�ZdS)�ChaCha20Poly1305Cipherz�ChaCha20-Poly1305 and XChaCha20-Poly1305 cipher object.
    Do not create it directly. Use :py:func:`new` instead.

    :var nonce: The nonce with length 8, 12 or 24 bytes
    :vartype nonce: byte string
    c�t�tdd|��|_|j|j|j|j|jf|_tj	||t���|_tj	||���|_|j�
d��d|_d|_d|_t"j|_dS)z`Initialize a ChaCha20-Poly1305 AEAD cipher object

        See also `new()` at the module level.N)�key�nonce�cipher)rr�@r)r
r�update�encrypt�decrypt�digest�verify�_nextr�newr�_authenticator�_cipher�seek�_len_aad�_len_ct�_mac_tag�
_CipherStatusr�_status)�selfrrs   r�__init__zChaCha20Poly1305Cipher.__init__=s���
!��t�U�3�3��
��k�4�<���t�{��k�#��
�'�l�s�%��Q�Q�Q����|��5�9�9�9�������"������
������
�$�9����rc��|j|jvrtd���|xjt	|��z
c_|j�|��dS)a�Protect the associated data.

        Associated data (also known as *additional authenticated data* - AAD)
        is the piece of the message that must stay in the clear, while
        still allowing the receiver to verify its integrity.
        An example is packet headers.

        The associated data (possibly split into multiple segments) is
        fed into :meth:`update` before any call to :meth:`decrypt` or :meth:`encrypt`.
        If there is no associated data, :meth:`update` is not called.

        :param bytes/bytearray/memoryview assoc_data:
            A piece of associated data. There are no restrictions on its size.
        z update() method cannot be calledN)r"r'�	TypeErrorr,�lenr))r1�datas  rr"zChaCha20Poly1305Cipher.updateQsU�� �;�d�j�(�(��>�?�?�?��
�
��T���"�
�
���"�"�4�(�(�(�(�(rc��|jtjksJ�|jdzr(|j�dd|jdzz
z��tj|_dS)N���)r0r/rr,r)r"r�r1s r�_pad_aadzChaCha20Poly1305Cipher._pad_aadgs^���|�}�A�A�A�A�A��=�4��	P���&�&�w�"��
��8L�2M�'N�O�O�O�$�:����rNc��|j|jvrtd���|jtjkr|���|j|jf|_|j�||���}|xj	t|��z
c_	|�|j�|��n|j�|��|S)a�Encrypt a piece of data.

        Args:
          plaintext(bytes/bytearray/memoryview): The data to encrypt, of any size.
        Keyword Args:
          output(bytes/bytearray/memoryview): The location where the ciphertext
            is written to. If ``None``, the ciphertext is returned.
        Returns:
          If ``output`` is ``None``, the ciphertext is returned as ``bytes``.
          Otherwise, ``None``.
        z!encrypt() method cannot be called��output)
r#r'r4r0r/rr<r%r*r-r5r)r")r1�	plaintextr?�results    rr#zChaCha20Poly1305Cipher.encryptns����<�t�z�)�)��?�@�@�@��<�=�=�=�=��M�M�O�O�O��l�D�K�0��
���%�%�i��%�?�?������I���&����>���&�&�v�.�.�.�.���&�&�v�.�.�.��
rc�Z�|j|jvrtd���|jtjkr|���|j|jf|_|xjt|��z
c_|j
�|��|j�||���S)a�Decrypt a piece of data.

        Args:
          ciphertext(bytes/bytearray/memoryview): The data to decrypt, of any size.
        Keyword Args:
          output(bytes/bytearray/memoryview): The location where the plaintext
            is written to. If ``None``, the plaintext is returned.
        Returns:
          If ``output`` is ``None``, the plaintext is returned as ``bytes``.
          Otherwise, ``None``.
        z!decrypt() method cannot be calledr>)
r$r'r4r0r/rr<r&r-r5r)r"r*)r1�
ciphertextr?s   rr$zChaCha20Poly1305Cipher.decrypt�s����<�t�z�)�)��?�@�@�@��<�=�=�=�=��M�M�O�O�O��l�D�K�0��
�����J���'�����"�"�:�.�.�.��|�#�#�J�v�#�>�>�>rc�t�|jr|jtjksJ�|jS|jtjksJ�|jtjkr|���|jdzr(|j�dd|jdzz
z��tj|_|j�t|j
d��ddd���|j�t|jd��ddd���|j���|_|jS)z=Finalize the cipher (if not done already) and return the MAC.r8r9r:�N���)r.r0r/rrr<r-r)r"r	r,r%r;s r�_compute_macz#ChaCha20Poly1305Cipher._compute_mac�s���=�	!��<�=�#@�@�@�@�@��=� ��|�}�<�<�<�<�<��<�=�=�=�=��M�M�O�O�O��<�$��	O���&�&�w�"���t�8K�2L�'M�N�N�N�$�4�����"�"�=����#B�#B�4�4�R�4�#H�I�I�I���"�"�=���q�#A�#A�$�$�B�$�#G�H�H�H��+�2�2�4�4��
��}�rc�~�|j|jvrtd���|jf|_|���S)zgCompute the *binary* authentication tag (MAC).

        :Return: the MAC tag, as 16 ``bytes``.
        z digest() method cannot be called)r%r'r4rGr;s rr%zChaCha20Poly1305Cipher.digest�s?���;�d�j�(�(��>�?�?�?��k�^��
�� � �"�"�"rc�d�d�d�|���D����S)z�Compute the *printable* authentication tag (MAC).

        This method is like :meth:`digest`.

        :Return: the MAC tag, as a hexadecimal string.
        �c�2�g|]}dt|��z��S)z%02x)r)�.0�xs  r�
<listcomp>z4ChaCha20Poly1305Cipher.hexdigest.<locals>.<listcomp>�s#��@�@�@�Q���a���(�@�@�@r)�joinr%r;s r�	hexdigestz ChaCha20Poly1305Cipher.hexdigest�s-���w�w�@�@�$�+�+�-�-�@�@�@�A�A�Arc�x�|j|jvrtd���|jf|_td��}|���tjd||j���}tjd||���}|���|���krtd���dS)a�Validate the *binary* authentication tag (MAC).

        The receiver invokes this method at the very end, to
        check if the associated data (if any) and the decrypted
        messages are valid.

        :param bytes/bytearray/memoryview received_mac_tag:
            This is the 16-byte *binary* MAC, as received from the sender.
        :Raises ValueError:
            if the MAC does not match. The message has been tampered with
            or the key is incorrect.
        z3verify() cannot be called when encrypting a messager:�)�digest_bitsrr6zMAC check failedN)
r&r'r4rrGrr(r.r%�
ValueError)r1�received_mac_tag�secret�mac1�mac2s     rr&zChaCha20Poly1305Cipher.verify�s����;�d�j�(�(��9�:�:�
:��k�^��
�!�"�%�%���������{�s�� $�
�/�/�/���{�s�� 0�2�2�2���;�;�=�=�D�K�K�M�M�)�)��/�0�0�0�*�)rc�J�|�t|����dS)a@Validate the *printable* authentication tag (MAC).

        This method is like :meth:`verify`.

        :param string hex_mac_tag:
            This is the *printable* MAC.
        :Raises ValueError:
            if the MAC does not match. The message has been tampered with
            or the key is incorrect.
        N)r&r)r1�hex_mac_tags  r�	hexverifyz ChaCha20Poly1305Cipher.hexverify�s$��	
���I�k�*�*�+�+�+�+�+rc�T�|�|��|���fS)aHPerform :meth:`encrypt` and :meth:`digest` in one step.

        :param plaintext: The data to encrypt, of any size.
        :type plaintext: bytes/bytearray/memoryview
        :return: a tuple with two ``bytes`` objects:

            - the ciphertext, of equal length as the plaintext
            - the 16-byte MAC tag
        )r#r%)r1r@s  r�encrypt_and_digestz)ChaCha20Poly1305Cipher.encrypt_and_digest�s#���|�|�I�&�&����
�
�5�5rc�Z�|�|��}|�|��|S)a�Perform :meth:`decrypt` and :meth:`verify` in one step.

        :param ciphertext: The piece of data to decrypt.
        :type ciphertext: bytes/bytearray/memoryview
        :param bytes received_mac_tag:
            This is the 16-byte *binary* MAC, as received from the sender.
        :return: the decrypted data (as ``bytes``)
        :raises ValueError:
            if the MAC does not match. The message has been tampered with
            or the key is incorrect.
        )r$r&)r1rCrUr@s    r�decrypt_and_verifyz)ChaCha20Poly1305Cipher.decrypt_and_verify	s.���L�L��,�,�	����$�%�%�%��r)N)�__name__�
__module__�__qualname__�__doc__r2r"r<r#r$rGr%rPr&r[r]r_rrrrr5s���������:�:�:�()�)�)�,;�;�;�����:?�?�?�?�2���,
#�
#�
#�B�B�B�1�1�1�>,�,�,�6�6�6�����rrc�\�	|�d��}n$#t$r}td|z���d}~wwxYwt|��dkrtd���|�dd��}|�td��}t|��dvrnHt|��d	kr&t||dd
���}d|d
d�z}ntd���t|��std
���|rtdt|��z���t||��S)a�Create a new ChaCha20-Poly1305 or XChaCha20-Poly1305 AEAD cipher.

    :keyword key: The secret key to use. It must be 32 bytes long.
    :type key: byte string

    :keyword nonce:
        A value that must never be reused for any other encryption
        done with this key.

        For ChaCha20-Poly1305, it must be 8 or 12 bytes long.

        For XChaCha20-Poly1305, it must be 24 bytes long.

        If not provided, 12 ``bytes`` will be generated randomly
        (you can find them back in the ``nonce`` attribute).
    :type nonce: bytes, bytearray, memoryview

    :Return: a :class:`Cryptodome.Cipher.ChaCha20.ChaCha20Poly1305Cipher` object
    rzMissing parameter %sN� zKey must be 32 bytes longr�)rErf�r:sz$Nonce must be 8, 12 or 24 bytes longz,nonce must be bytes, bytearray or memoryviewzUnknown parameters: )
�pop�KeyErrorr4r1r-r5r@rTrrr�strr)�kwargsr�ers    rr(r(sC��*'��j�j��������'�'�'��.��2�3�3�3�����'����
�3�x�x�2�~�~��4�5�5�5��J�J�w��%�%�E��}� ��$�$��
�5�z�z�W����	�U���r�	�	���e�C�R�C�j�)�)��#�e�B�C�C�j�0����?�@�@�@��U���H��F�G�G�G�
�>��.��V���<�=�=�=�!�#�u�-�-�-s��
9�4�9reN)�binasciir�Cryptodome.Cipherr�Cryptodome.Cipher.ChaCha20r�Cryptodome.Hashrr�Cryptodome.Randomr�Cryptodome.Util.numberr	�Cryptodome.Util.py3compatr
r�Cryptodome.Util._raw_apirrr/�objectrr(�key_sizerrr�<module>rws ��>������&�&�&�&�&�&�1�1�1�1�1�1�-�-�-�-�-�-�-�-�.�.�.�.�.�.�0�0�0�0�0�0�7�7�7�7�7�7�7�7�.�.�.�.�.�.�#�#�#���1�,-�&'�)�)�)�
�
c�c�c�c�c�V�c�c�c�L1.�1.�1.�j���r

Youez - 2016 - github.com/yon3zu
LinuXploit