Dashboard
PHP:
8.1.34
OS:
Linux
User:
uid288609
/
/
usr
/
lib
/
python3
/
dist-packages
/
cryptography
/
hazmat
/
primitives
/
kdf
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: kbkdf.cpython-39.pyc
a � `� � @ s� d dl mZmZmZ d dlmZ d dlmZ d dlm Z d dl mZmZm Z mZ d dlmZ d dlmZ d dlmZmZmZ d d lmZ G d d� de�ZG dd � d e�Ze �e�G dd� de��ZdS )� )�absolute_import�division�print_function)�Enum)�range)�utils)�AlreadyFinalized� InvalidKey�UnsupportedAlgorithm�_Reasons)�_get_backend)�HMACBackend)� constant_time�hashes�hmac)�KeyDerivationFunctionc @ s e Zd ZdZdS )�ModeZctrN)�__name__� __module__�__qualname__ZCounterMode� r r �J/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/kdf/kbkdf.pyr s r c @ s e Zd ZdZdZdS )�CounterLocationZbefore_fixedZafter_fixedN)r r r �BeforeFixed� AfterFixedr r r r r s r c @ s6 e Zd Zddd�Zdd� Zdd� Zdd � Zd d� ZdS ) � KBKDFHMACNc C sF t | �} t| t�stdtj��t|tj�s6tdtj��| � |�sLtdtj��t|t �s^td��t|t�sptd��|sx|r�| r�t d��|d u s�| �|�s�t d��|d u r�| d u r�t d��|d ur�t|t�s�td ��|d u r�d }|d u r�d }t�d|� t�d|� || _|| _|| _|| _|| _|| _|| _|| _| | _d | _| | _d S )Nz.Backend object does not implement HMACBackend.z5Algorithm supplied is not a supported hash algorithm.z5Algorithm supplied is not a supported hmac algorithm.zmode must be of type Modez(location must be of type CounterLocationz9When supplying fixed data, label and context are ignored.zrlen must be between 1 and 4zPlease specify an llenzllen must be an integer� �label�contextF)r � isinstancer r r ZBACKEND_MISSING_INTERFACEr Z HashAlgorithmZUNSUPPORTED_HASHZhmac_supportedr � TypeErrorr � ValueError�_valid_byte_length�intr �_check_bytes� _algorithm�_mode�_length�_rlen�_llen� _location�_label�_context�_backend�_used�_fixed_data)�self� algorithm�modeZlengthZrlenZllen�locationr r Zfixed�backendr r r �__init__# s^ �� � �zKBKDFHMAC.__init__c C s@ t |t�std��t�d|�}dt|� kr6dks<n dS dS )Nzvalue must be of type int� � FT)r r# r r �int_to_bytes�len)r0 �valueZ value_binr r r r"