관리-도구
편집 파일: ChaCha20_Poly1305.cpython-311.pyc
� O�Dg)- � � � d dl mZ d dlmZ d dlmZ d dlmZmZ d dl m Z d dlmZ d dl mZmZ d dlmZ d � Z ed dd� � � Z G d� de� � Zd� ZdZdS )� )� unhexlify)�ChaCha20)� _HChaCha20)�Poly1305�BLAKE2s)�get_random_bytes)� long_to_bytes)�_copy_bytes�bord)� is_bufferc �$ � t dd| � � S )N�Enum� )�type)�enumss ��/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/ChaCha20_Poly1305.py�_enumr , s � ����E�"�"�"� � � � )�PROCESSING_AUTH_DATA�PROCESSING_CIPHERTEXT�PROCESSING_DONEc �^ � e Zd ZdZd� Zd� Zd� Zdd�Zdd�Zd� Z d � Z d � Zd� Zd� 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 � � d| _ t j ||t �� � | _ t j ||�� � | _ | j � d� � d| _ d| _ d| _ t j | _ dS )z`Initialize a ChaCha20-Poly1305 AEAD cipher object See also `new()` at the module level.)�update�encrypt�decrypt�digest�verify)�key�nonce�cipher)r# r$ �@ r N) �_nextr �newr �_authenticator�_cipher�seek�_len_aad�_len_ct�_mac_tag� _CipherStatusr �_status)�selfr# r$ s r �__init__zChaCha20Poly1305Cipher.__init__= su � � �� � '�l�s�%��Q�Q�Q����|��5�9�9�9�������"������ ������ �$�9����r c � � d| j vrt d� � �| xj t |� � 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. r z update() method cannot be calledN)r'