var/opt/nydus/ops/oscrypto/__pycache__/_pkcs5.cpython-38.pyc000064400000005466147205546750020041 0ustar00U afU @sddlmZmZmZmZddlZddlZddlZddlZddl m Z m Z ddl m Z ddlmZmZmZejdkrxeZndd Zd gZd d Zd e_dS) )unicode_literalsdivisionabsolute_importprint_functionN)int_from_bytes int_to_bytes)pretty_message) type_namebyte_cls int_types)cCs t|gS)N)bytes)numr@/opt/nydus/tmp/pip-target-53d1vnqk/lib/python/oscrypto/_pkcs5.pychr_clssrpbkdf2cCst|tsttdt|t|ts8ttdt|t|tsTttdt||dkrnttdt|t|tsttdt||dkrttdt||tdd d d d d gkrttdt|t t |}ddddddd|}t |d|}d}d} t | |kr|} | |td|| } t| } t|dD],} |} | | | } | t| N} qL| t| |d7} |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 md5sha1sha224sha256sha384sha512z hash_algorithm must be one of "md5", "sha1", "sha224", "sha256", "sha384", "sha512", not %s  0@)rrrrrrNs>I)widthr) isinstancer TypeErrorr r r ValueErrorreprsetgetattrhashlibhmacnewlencopyupdatestructpackdigestrranger)Zhash_algorithmpasswordZsaltZ iterationsZ key_lengthalgoZ hash_lengthZ original_hmacblockoutputZprflastu_rrrrsz        T) __future__rrrrsysr(r)r.Z_asn1rr_errorsr _typesr r r version_infochrr__all__rZ pure_pythonrrrrs  t