%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/nacl/pwhash/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/nacl/pwhash/__pycache__/scrypt.cpython-312.pyc

�

�fJ����ddlmZddlZddlZddlmZddlmZejjZejjZ
ejjZejj Zejj$Zejj(Zedz
Zejj.Zejj2Zejj6Zejj:Zejj>Z ejjBZ"ejjFZ$ejjJZ&ejjNZ(ejjRZ*de$zZ+de&zZ,e(e*ejZj\fde/de0d	e0d
e/de/dejZjbd
e0fd�Z2e$e&fde0d
e/de/d
e0fd�Z3de0de0d
e4fd�Z5y)�)�castN)�
exceptions)�ensure���size�password�salt�opslimit�memlimit�encoder�returnc��ttdtj��tt	|�t
k(dt
�dt	|��d�tj��tjj||�\}}}|dz}	|jtjj||ttd|z�|||	|���S)	al
    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
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.

    .. versionadded:: 1.2
    �Not available in minimal build��raisingzThe salt must be exactly z, not z bytes longi�)�maxmem�dklen)r�	AVAILABLE�exc�UnavailableError�len�	SALTBYTES�
ValueError�nacl�bindings� nacl_bindings_pick_scrypt_params�encode�%crypto_pwhash_scryptsalsa208sha256_llr�int)
rr	r
rrr
�n_log2�r�prs
          �4/usr/lib/python3/dist-packages/nacl/pwhash/scrypt.py�kdfr&;s���r��(��$�$����D�	�Y���c�$�i�	!����	��=�=�A�A��(��L�F�A�q���
!�F��>�>��
�
�;�;���
��a�6�k�"�
�
���	<�	
�
�
�c��ttdtj��tj
j
|||�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
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.

    .. versionadded:: 1.2
    rr)rrrrrr�&crypto_pwhash_scryptsalsa208sha256_str)r	rrs   r%�strr*�s;��,��(��$�$���=�=�?�?��(�H��r'�
password_hashc��ttdtj��tt	|�t
k(dtjjztj��tjj||�S)aW
    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
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.

    .. versionadded:: 1.2
    rrz/The password hash must be exactly %s bytes long)rrrrr�PWHASH_SIZErr�+crypto_pwhash_scryptsalsa208sha256_STRBYTESr�-crypto_pwhash_scryptsalsa208sha256_str_verify)r+r	s  r%�verifyr0�sm����(��$�$����M��k�)�9�
�-�-�
C�
C�	D����	��=�=�F�F��x��r')6�typingr�
nacl.bindingsr�
nacl.encodingrr�nacl.exceptionsrrr.�_strbytes_plus_one�&has_crypto_pwhash_scryptsalsa208sha256r�,crypto_pwhash_scryptsalsa208sha256_STRPREFIX�	STRPREFIX�,crypto_pwhash_scryptsalsa208sha256_SALTBYTESr�-crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN�
PASSWD_MIN�-crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX�
PASSWD_MAXr-�,crypto_pwhash_scryptsalsa208sha256_BYTES_MIN�	BYTES_MIN�,crypto_pwhash_scryptsalsa208sha256_BYTES_MAX�	BYTES_MAX�/crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN�MEMLIMIT_MIN�/crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX�MEMLIMIT_MAX�/crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN�OPSLIMIT_MIN�/crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX�OPSLIMIT_MAX�7crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE�OPSLIMIT_INTERACTIVE�7crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE�MEMLIMIT_INTERACTIVE�5crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE�OPSLIMIT_SENSITIVE�5crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE�MEMLIMIT_SENSITIVE�OPSLIMIT_MODERATE�MEMLIMIT_MODERATE�encoding�
RawEncoderr!�bytes�Encoderr&r*�boolr0�r'r%�<module>rZs������"�"��]�]�N�N���M�M�@�@�	��M�M�F�F�	��M�M�F�F�	�
�]�]�
H�
H�
�
�]�]�
H�
H�
� �1�$���M�M�F�F�	��M�M�F�F�	��}�}�L�L���}�}�L�L���}�}�L�L���}�}�L�L��	�M�M�I�I��	�M�M�I�I��	�M�M�G�G��	�M�M�G�G���,�,���,�,��'�&�%)�]�]�%=�%=�
X�

�X��X��X��	X�
�X��]�]�
"�
"�
X��X�z)�(���������	�B�%��5��T�r'

Zerion Mini Shell 1.0