← Back
Editing: test_OCB.cpython-311.pyc
� 8�tc�n � �@ � d dl Z d dlZd dlZd dlmZmZ d dlmZmZm Z d dl mZ d dlm Z d dlmZ d dlmZ d dlmZ d � Z G d � dej � � Z G d� d ej � � Z G d� dej � � Zi fd�Zedk rd dlZd� Z ej d�� � dS dS )� N)�hexlify� unhexlify)�b�tobytes�bchr��strxor_c)� long_to_bytes)�list_test_cases)�AES)�SHAKE128c �l � t j t | � � �� � � |� � S )N)�data)r �newr �read)�tag�lengths �E/usr/lib/python3/dist-packages/Cryptodome/SelfTest/Cipher/test_OCB.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 )�OcbTests�key_128� � nonce_128� �data_128c �Z � t j | j t j | j �� � }t dd� � }|� |� � \ }}t j | j t j | j �� � }|� ||� � }| � ||� � d S )N��nonce� plaintexti@ ) r r r �MODE_OCB�nonce_96r �encrypt_and_digest�decrypt_and_verify�assertEqual)�self�cipher�pt�ct�mac�pt2s r �test_loopback_128zOcbTests.test_loopback_1287 s� � �����s�|�4�=�I�I�I�� �K�� 2� 2���+�+�B�/�/���C�����s�|�4�=�I�I�I���'�'��C�0�0������S�!�!�!�!�!r c � � t j | j t j � � t j | j t j | j � � }|� | j � � }t j | j t j | j �� � }| � ||� | j � � � � d S �Nr )r r r r"