Your IP : 18.119.124.24
�
O�Dgo( � � � d dl mZ d dlmZ d dlmZ d dlmZmZ d dl m
Z
mZmZ d dl
mZ dZd
d�Z G d � d
e� � Z dd�ZdS )� )� unhexlify)�BLAKE2s)�strxor)�
long_to_bytes�
bytes_to_long)�bord�tobytes�_copy_bytes)�get_random_bytesNc � � t | � � dz |z }t |t | � � � � t | � � d � S )N� )r r �len)�bs�xor_lsb�nums �r/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Hash/CMAC.py�_shift_bytesr $ s@ � ������!�W�
,�C���c�"�g�g�&�&��B���x�y�y�1�1� c �F � e Zd ZdZdZd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� ZdS )�CMACz�A CMAC hash object.
Do not instantiate directly. Use the :func:`new` function.
:ivar digest_size: the size in bytes of the resulting MAC tag
:vartype digest_size: integer
Nc �h � || _ t d d |� � | _ || _ || _ |j x| _ }d | _ || _ |dk r
d}d| _ n"|dk r
d}d| _ nt d|z � � �d|z } |j ||j fi | j ��| _
| j
� | � � }
t |
d � � d
z rt! |
|� � | _ nt! |
� � | _ t | j d � � d
z rt! | j |� � | _ nt! | j � � | _ |j ||j | fi | j ��| _ t+ |� � | _ d | _ | | _ d | _ d | _ |r| � |� � d S d S )N� � i � � l � zACMAC requires a cipher with a block size of 8 or 16 bytes, not %d� r � )�digest_sizer
�_key�_factory�_cipher_params�
block_size�_block_size�_mac_tag�_update_after_digest� _max_size� TypeError�new�MODE_ECB�_ecb�encryptr r �_k1�_k2�MODE_CBC�_cbc� bytearray�_cache�_cache_n�_last_ct�_last_pt�
_data_size�update)�self�key�msg� ciphermod�
cipher_params�mac_len�update_after_digestr �const_Rb�
zero_block�Ls r �__init__z
CMAC.__init__3 s� � � #�����d�C�0�0�� �!��
�+��� )� 4�4���2���
�$7��!� ��7�7��H�*�D�N�N�
�2�X�X��H�+�D�N�N�� 8�:<�=� >� >�
>� �r�\�
�!�I�M�#�"+�"4�9� 9�$(�$7�9� 9�� �
�I���j�)�)����!��:�:��� '�#�A�x�0�0�D�H�H�#�A���D�H��������t�#� .�#�D�H�h�7�7�D�H�H�#�D�H�-�-�D�H� "�I�M�#�"+�"4�",�9� 9� %)�$7�9� 9�� � ��m�m�����
� #��
� ��
� ���� ��K�K������� � r c � � | j �| j st d� � �| xj t |� � z
c_ | j }| j dk r�t || j z
t |� � � � }|d|� | j | j | j |z �<