Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/Cryptodome/Protocol/__pycache__/KDF.cpython-39.pyc
Ðазад
a c�h�M � @ s d dl Z d dlZd dlmZ d dlmZmZmZmZm Z m Z mZ d dlm Z mZmZmZmZ d dlmZ d dlmZ d dlmZmZmZ d dlmZmZmZmZ ed d �Z edd�Z!d$dd�Z"d%dd�Z#G dd� de$�Z%d&dd�Z&d'dd�Z'dd� Z(dd� Z)dd� Z*d(d d!�Z+d"d#� Z,dS ))� N)�reduce)�tobytes�bord�_copy_bytes� iter_range�tostr�bchr�bstr)�SHA1�SHA256�HMAC�CMAC�BLAKE2s)�strxor)�get_random_bytes)�size� long_to_bytes� bytes_to_long)�load_pycryptodome_raw_lib�create_string_buffer�get_raw_buffer�c_size_tzCryptodome.Cipher._Salsa20z� int Salsa20_8_core(const uint8_t *x, const uint8_t *y, uint8_t *out); zCryptodome.Protocol._scrypta typedef int (core_t)(const uint8_t [64], const uint8_t [64], uint8_t [64]); int scryptROMix(const uint8_t *data_in, uint8_t *data_out, size_t data_len, unsigned N, core_t *core); �� c C s� |st }t| �} |�| | �}|j}||kr8td| ��t|�dkrTtdt|� ��t|d �D ]}|�|�� �}q`|�� d|� S )aY Derive one key from a password (or passphrase). This function performs key derivation according to an old version of the PKCS#5 standard (v1.5) or `RFC2898 <https://www.ietf.org/rfc/rfc2898.txt>`_. Args: password (string): The secret password to generate the key from. salt (byte string): An 8 byte string to use for better protection from dictionary attacks. This value does not need to be kept secret, but it should be randomly chosen for each derivation. dkLen (integer): The length of the desired key. The default is 16 bytes, suitable for instance for :mod:`Cryptodome.Cipher.AES`. count (integer): The number of iterations to carry out. The recommendation is 1000 or more. hashAlgo (module): The hash algorithm to use, as a module or an object from the :mod:`Cryptodome.Hash` package. The digest length must be no shorter than ``dkLen``. The default algorithm is :mod:`Cryptodome.Hash.SHA1`. Return: A byte string of length ``dkLen`` that can be used as key. z:Selected hash algorithm has a too short digest (%d bytes).� z,Salt is not 8 bytes long (%d bytes instead).� N) r r �new�digest_size� TypeError�len� ValueErrorr �digest)�password�salt�dkLen�countZhashAlgoZpHashr �i� r&