HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/oscrypto/__pycache__/_pkcs5.cpython-39.pyc
a

�,�hU
�@s�ddlmZmZmZmZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
ddlmZmZmZejdkrxeZndd	�Zd
gZdd
�Zde_dS)
�)�unicode_literals�division�absolute_import�print_functionN�)�int_from_bytes�int_to_bytes)�pretty_message)�	type_name�byte_cls�	int_types)�cCs
t|g�S)N)�bytes)�num�r�@/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/oscrypto/_pkcs5.py�chr_clssr�pbkdf2cCs�t|t�sttdt|����t|t�s8ttdt|����t|t�sTttdt|����|dkrnttdt|����t|t�s�ttdt|����|dkr�ttdt|����|tgd��vr�ttd	t|����t	t
|�}d
ddd
ddd�|}t�|d|�}d}d}	t
|	�|k�r�|��}
|
�|t�d|��|
��}t|�}t|d�D],}
|��}
|
�|�|
��}|t|�N}�qD|	t||d�7}	|d7}q�|	d|�S)a4
    Implements PBKDF2 from PKCS#5 v2.2 in pure Python

    :param hash_algorithm:
        The string name of the hash algorithm to use: "md5", "sha1", "sha224",
        "sha256", "sha384", "sha512"

    :param password:
        A byte string of the password to use an input to the KDF

    :param salt:
        A cryptographic random byte string

    :param iterations:
        The numbers of iterations to use when deriving the key

    :param key_length:
        The length of the desired key in bytes

    :return:
        The derived key as a byte string
    z@
            password must be a byte string, not %s
            z<
            salt must be a byte string, not %s
            z?
            iterations must be an integer, not %s
            rzC
            iterations must be greater than 0 - is %s
            z?
            key_length must be an integer, not %s
            zC
            key_length must be greater than 0 - is %s
            )�md5�sha1�sha224�sha256�sha384�sha512z�
            hash_algorithm must be one of "md5", "sha1", "sha224", "sha256",
            "sha384", "sha512", not %s
            ���� �0�@N�s>I)�widthr)�
isinstancer�	TypeErrorr	r
r�
ValueError�repr�set�getattr�hashlib�hmac�new�len�copy�update�struct�pack�digestr�ranger)Zhash_algorithm�passwordZsaltZ
iterationsZ
key_length�algoZhash_lengthZ
original_hmac�block�outputZprf�last�u�_rrrrsz
�
�
��
���
��	

T)�
__future__rrrr�sysr(r)r.Z_asn1rr�_errorsr	�_typesr
rr�version_info�chrr�__all__rZpure_pythonrrrr�<module>s
�t