관리-도구
편집 파일: test_ChaCha20_Poly1305.cpython-311.pyc
� O�Dg�w � � � d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl m Z d dlmZ d dl mZ d � Z G d � de j � � Z G d� d e j � � Z G d� de j � � Zd� Z G d� de j � � Z G d� de j � � Z G d� de j � � Zi fd�Zedk rd� Z e j d�� � dS dS )� N)� unhexlify)�list_test_cases��load_test_vectors_wycheproof)�tobytes)�ChaCha20_Poly1305)�SHAKE128)�strxorc �l � t j t | � � �� � � |� � S )N)�data)r �newr �read)�tag�lengths ��/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/SelfTest/Cipher/test_ChaCha20_Poly1305.py�get_tag_randomr + s) � ��<�W�S�\�\�*�*�*�/�/��7�7�7� c � � e Zd Z edd� � Z edd� � Z edd� � Zd� Zd� Zd � Z d � Z d� Zd� Zd � Z d� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� ZdS )�ChaCha20Poly1305Tests�key_256� �nonce_96� �data_128� c �& � t j | j | j �� � }t dd� � }|� |� � }t j | j | j �� � }|� |� � }| � ||� � d S )N��key�nonce� plaintexti@ )r r r r r �encrypt�decrypt�assertEqual)�self�cipher�pt�ct�pt2s r � test_loopbackz#ChaCha20Poly1305Tests.test_loopback5 s� � �"�&�4�<�-1�]�<� <� <�� �K�� 2� 2�� �^�^�B� � ��"�&�4�<�-1�]�<� <� <���n�n�R� � ������S�!�!�!�!�!r c � � t j | j d�� � }| � t |j � � d� � t j | j d�� � }| � t |j � � d� � t j | j �� � }|j }t j | j �� � }|j }| � t |� � d� � | � ||� � t j | j | j �� � }|� | j � � }t j | j | j �� � }| � ||� | j � � � � d S )Ns HHHHHHHHr � s HHHHHHHHHHHHr �r ) r r r r# �lenr �assertNotEqualr r! r )r$ r% �nonce1�nonce2r'