관리-도구
편집 파일: test_KMAC.cpython-311.pyc
� O�Dg�- � � � d dl Z d dlmZmZ d dlmZ d dlmZ d dlm Z d dl mZmZ G d� de j � � Z G d � d e� � Z G d� de� � Z G d � de j � � Zi fd�Zedk rd� Z e j d�� � dS dS )� N)� unhexlify�hexlify)�tobytes)�strxor_c)�list_test_cases)�KMAC128�KMAC256c �b � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z d� Zd � Zd� ZdS )�KMACTestc �@ � | j j |dd| j dz z i|��S )N�key� X� )�KMAC�new�minimum_key_bits)�self�args�kwargss ��/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/SelfTest/Hash/test_KMAC.pyr zKMACTest.new s- � ��t�y�}�t�V���)>�!�)C�!D�V�v�V�V�V� c �2 � d}| � � � }| j j |j fD ]�}t | j d� � D ]*} |||�� � }| � |j |� � �+ ||d�� � � � � } ||�� � � d� � � � � }| � ||� � |d|d� � � ��|� |�� � }| � |j | j � � d S ) N� XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX� �r �mac_len� �)r �data�r � A� g)r r �custom) r r �range� minimum_bytes�assertEqual�digest_size�digest�update� default_bytes)r r �h�new_func�dbytes�hobj�digest1�digest2s r �test_new_positivezKMACTest.test_new_positive s) � ����H�H�J�J��� � �q�u�,� 6� 6�H��� 2�G�<�<� ;� ;���x�C��8�8�8��� � ��!1�6�:�:�:�:��h�3�W�5�5�5�<�<�>�>�G��h�3�'�'�'�.�.�w�7�7�>�>�@�@�G����W�g�.�.�.��H�$�C��5�5�5�5�5��u�u��u�~�~������)�4�+=�>�>�>�>�>r c �V � | � � � }| j j |j fD ]�}| � t |dd�� � | � t |d| j dz �� � | � t |d�� � | � t |d�� � ��d S )Nr r r � �stringr �r )r r �assertRaises� ValueErrorr$ � TypeError)r r* r+ s r �test_new_negativezKMACTest.test_new_negative$ s� � ��H�H�J�J��� � �q�u�,� .� .�H����j�(��&'� � )� )� )����j�(��&*�&8�1�&<� � >� >� >����i��"+� � -� -� -����i��#,� � .� .� .� .� .� .r c � � | � d�� � � � � }| � t |� � | j � � d S )Ns abcr4 )r r'