File: //opt/saltstack/salt/lib/python3.10/site-packages/Cryptodome/Hash/__pycache__/HMAC.cpython-310.pyc
o
;j� � @ s� d dl mZmZ d dlmZ d dlmZ d dlmZ d dl m
Z
ddgZdd d
ddd
dddddd�Zdd� e�
� D �ZG dd� de�Zddd�ZdS )� )�bord�tobytes)� unhexlify)�BLAKE2s)�strxor)�get_random_bytes�new�HMACz1.2.840.113549.2.7z1.2.840.113549.2.8z1.2.840.113549.2.9z1.2.840.113549.2.10z1.2.840.113549.2.11z1.2.840.113549.2.12z1.2.840.113549.2.13z2.16.840.1.101.3.4.2.13z2.16.840.1.101.3.4.2.14z2.16.840.1.101.3.4.2.15z2.16.840.1.101.3.4.2.16)z
1.3.14.3.2.26z2.16.840.1.101.3.4.2.4z2.16.840.1.101.3.4.2.1z2.16.840.1.101.3.4.2.2z2.16.840.1.101.3.4.2.3z2.16.840.1.101.3.4.2.5z2.16.840.1.101.3.4.2.6z2.16.840.1.101.3.4.2.7z2.16.840.1.101.3.4.2.8z2.16.840.1.101.3.4.2.9z2.16.840.1.101.3.4.2.10c C s i | ]\}}||�qS � r
)�.0�k�vr
r
�H/opt/saltstack/salt/lib/python3.10/site-packages/Cryptodome/Hash/HMAC.py�
<dictcomp>: s r c @ sR e Zd ZdZddd�Zdd� Zdd � Zd
d� Zdd
� Zdd� Z dd� Z
dd� ZdS )r aB An HMAC 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
:ivar oid: the ASN.1 object ID of the HMAC algorithm.
Only present if the algorithm was officially assigned one.
� Nc C s |d u rddl m} |}|d u rd}|j| _|| _zt|j | _W n ttfy, Y nw t|t �r6|�
� }z't|�|jkrJ|d|jt|� }n|�
|��� }|d|jt|� }W n tyh td��w t|dt|� �}|�
|�| _| j�|� t|dt|� �}|�
|�| _d S )Nr )�MD5r � zHash type incompatible to HMAC� 6� \)�Cryptodome.Hashr �digest_size�
_digestmod�_hash2hmac_oid�oid�KeyError�AttributeError�
isinstance�
memoryviewr �len�
block_sizer �digest�
ValueErrorr �_inner�update�_outer) �self�key�msg� digestmodr Zkey_0Zhash_kZ
key_0_ipadZ
key_0_opadr
r
r �__init__H s8 �
��z
HMAC.__init__c C s | j �|� | S )z�Authenticate the next chunk of message.
Args:
data (byte string/byte array/memoryview): The next chunk of data
)r"