/var/opt/nydus/ops/oscrypto/_win/__pycache__
Edit: /var/opt/nydus/ops/oscrypto/_win/__pycache__/util.cpython-312.pyc (5563B)
Njr d dl mZmZmZmZ ddlmZ ddlmZ ddl m
Z
mZ ddlm
Z
ddlmZmZmZ g dZ e Zed k( rd
dlmZmZmZmZmZ d Zd
e_ d ZyddlmZ ddlmZ y) )unicode_literalsdivisionabsolute_importprint_function )backend)pretty_message)buffer_from_bytesbytes_from_buffer)
pkcs12_kdf) type_namebyte_cls int_types)pbkdf2r
rand_byteswin )bcryptBcryptConsthandle_erroropen_alg_handleclose_alg_handlec t |t st t dt | t |t st t dt | t |t
st t dt | |dk rt
d t |t
st t dt | |dk rt
d | t g d vrt
t d t | t j t j t j t j d| }d
} t |t j }t! | }t# j$ ||t' | |t' | |||d }t) | t+ | |rt- | S S # |rt- | w w xY w)a%
PBKDF2 from PKCS#5
:param hash_algorithm:
The string name of the hash algorithm to use: "sha1", "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
:raises:
ValueError - when any of the parameters contain an invalid value
TypeError - when any of the parameters are of the wrong type
OSError - when an error is returned by the OS crypto library
:return:
The derived key as a byte string
zH
password must be a byte string, not %s
zD
salt must be a byte string, not %s
zG
iterations must be an integer, not %s
r z!iterations must be greater than 0zG
key_length must be an integer, not %s
z!key_length must be greater than 0)sha1sha256sha384sha512z|
hash_algorithm must be one of "sha1", "sha256", "sha384", "sha512",
not %s
Nr )
isinstancer TypeErrorr r
r
ValueErrorsetreprr BCRYPT_SHA1_ALGORITHMBCRYPT_SHA256_ALGORITHMBCRYPT_SHA384_ALGORITHMBCRYPT_SHA512_ALGORITHMr BCRYPT_ALG_HANDLE_HMAC_FLAGr
r BCryptDeriveKeyPBKDF2lenr r r ) hash_algorithmpasswordsalt
iterations
key_lengthalg_constant
alg_handle
output_bufferress C/opt/nydus/tmp/pip-target-a90h98xg/lib/python/oscrypto/_win/util.pyr r s 8 (H-N (#
$)N $
*i0N *%
>@AA*i0N *%
>@AA%K!LL^ ^$
55!99!99!99
-({7^7^_J-j9M..H
D
C
$]3 , z , s
A)G GFc t | t st t dt | | dk rt d | dkD rt d d} t
t j }t | }t j ||| d }t | t | |rt | S S # |rt | w w xY w)a
Returns a number of random bytes suitable for cryptographic purposes
:param length:
The desired number of bytes
:raises:
ValueError - when any of the parameters contain an invalid value
TypeError - when any of the parameters are of the wrong type
OSError - when an error is returned by the OS crypto library
:return:
A byte string
zC
length must be an integer, not %s
r zlength must be greater than 0i z$length must not be greater than 1024Nr )r r r r r
r r r BCRYPT_RNG_ALGORITHMr
r BCryptGenRandomr r r )lengthr0 bufferr2 s r3 r r s &),N &!
A:<==D=CDD
-()I)IJJ&v.F((VVQGC$V, , z , s
AB2 2C)r )r N)
__future__r r r r r _errorsr _ffir
r _pkcs12r _typesr
r r __all___backend_cngr r r r r r pure_pythonr _pkcs5_rand r3
rG s\ R R $ 7 3 3 9 uZZh-T F+-^ "rF