HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/thread-self/root/lib/python3/dist-packages/nacl/pwhash/__pycache__/scrypt.cpython-38.pyc
U

�֫[��@s�ddlmZddlmZddlZddlZddlmZddlm	Z	ej
jZej
j
Zej
jZej
jZej
jZedZej
jZej
jZej
jZej
jZej
jZej
j Z!ej
j"Z#ej
j$Z%ej
j&Z'ej
j(Z)de#Z*de%Z+e'e)ej,j-fdd	�Z.e#e%fd
d�Z/dd
�Z0dS)�)�absolute_import)�divisionN)�
exceptions)�ensure��c
Csdtt|�tkdtt|�ftjd�tj�||�\}}}|d}	|�tjj	||d||||	|d��S)a
    Derive a ``size`` bytes long key from a caller-supplied
    ``password`` and ``salt`` pair using the scryptsalsa208sha256
    memory-hard construct.


    the enclosing module provides the constants

        - :py:const:`.OPSLIMIT_INTERACTIVE`
        - :py:const:`.MEMLIMIT_INTERACTIVE`
        - :py:const:`.OPSLIMIT_SENSITIVE`
        - :py:const:`.MEMLIMIT_SENSITIVE`
        - :py:const:`.OPSLIMIT_MODERATE`
        - :py:const:`.MEMLIMIT_MODERATE`

    as a guidance for correct settings respectively for the
    interactive login and the long term key protecting sensitive data
    use cases.

    :param size: derived key size, must be between
                 :py:const:`.BYTES_MIN` and
                 :py:const:`.BYTES_MAX`
    :type size: int
    :param password: password used to seed the key derivation procedure;
                     it length must be between
                     :py:const:`.PASSWD_MIN` and
                     :py:const:`.PASSWD_MAX`
    :type password: bytes
    :param salt: **RANDOM** salt used in the key derivation procedure;
                 its length must be exactly :py:const:`.SALTBYTES`
    :type salt: bytes
    :param opslimit: the time component (operation count)
                     of the key derivation procedure's computational cost;
                     it must be between
                     :py:const:`.OPSLIMIT_MIN` and
                     :py:const:`.OPSLIMIT_MAX`
    :type opslimit: int
    :param memlimit: the memory occupation component
                     of the key derivation procedure's computational cost;
                     it must be between
                     :py:const:`.MEMLIMIT_MIN` and
                     :py:const:`.MEMLIMIT_MAX`
    :type memlimit: int
    :rtype: bytes

    .. versionadded:: 1.2
    z.The salt must be exactly %s, not %s bytes long�Zraisingi�)�maxmemZdklen)
r�len�	SALTBYTES�exc�
ValueError�nacl�bindingsZ nacl_bindings_pick_scrypt_params�encodeZ%crypto_pwhash_scryptsalsa208sha256_ll)
�size�passwordZsalt�opslimit�memlimit�encoderZn_log2�r�pr
�r�4/usr/lib/python3/dist-packages/nacl/pwhash/scrypt.py�kdf6s.3
��	�
��rcCstj�|||�S)a�
    Hashes a password with a random salt, using the memory-hard
    scryptsalsa208sha256 construct and returning an ascii string
    that has all the needed info to check against a future password

    The default settings for opslimit and memlimit are those deemed
    correct for the interactive user login case.

    :param bytes password:
    :param int opslimit:
    :param int memlimit:
    :rtype: bytes

    .. versionadded:: 1.2
    )rrZ&crypto_pwhash_scryptsalsa208sha256_str)rrrrrr�str|s�rcCs.tt|�tkdtjjtjd�tj�||�S)z�
    Takes the output of scryptsalsa208sha256 and compares it against
    a user provided password to see if they are the same

    :param password_hash: bytes
    :param password: bytes
    :rtype: boolean

    .. versionadded:: 1.2
    z/The password hash must be exactly %s bytes longr)	rr�PWHASH_SIZErr�+crypto_pwhash_scryptsalsa208sha256_STRBYTESr
rZ-crypto_pwhash_scryptsalsa208sha256_str_verify)Z
password_hashrrrr�verify�s���r)1Z
__future__rrZ
nacl.bindingsrZ
nacl.encodingrr
Znacl.exceptionsrrrZ_strbytes_plus_oneZ,crypto_pwhash_scryptsalsa208sha256_STRPREFIXZ	STRPREFIXZ,crypto_pwhash_scryptsalsa208sha256_SALTBYTESrZ-crypto_pwhash_scryptsalsa208sha256_PASSWD_MINZ
PASSWD_MINZ-crypto_pwhash_scryptsalsa208sha256_PASSWD_MAXZ
PASSWD_MAXrZ,crypto_pwhash_scryptsalsa208sha256_BYTES_MINZ	BYTES_MINZ,crypto_pwhash_scryptsalsa208sha256_BYTES_MAXZ	BYTES_MAXZ/crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MINZMEMLIMIT_MINZ/crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAXZMEMLIMIT_MAXZ/crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MINZOPSLIMIT_MINZ/crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAXZOPSLIMIT_MAXZ7crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVEZOPSLIMIT_INTERACTIVEZ7crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVEZMEMLIMIT_INTERACTIVEZ5crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVEZOPSLIMIT_SENSITIVEZ5crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVEZMEMLIMIT_SENSITIVEZOPSLIMIT_MODERATEZMEMLIMIT_MODERATE�encodingZ
RawEncoderrrrrrrr�<module>sF�����
G�