U
    Î‚³d5  ã                	   @   sì   d dl Zd dlZddlmZ ejZejjZ	ej
Z
ejZejZejZejZejZejZejjZejjZejjZejjZejjZejjZejjZejjZ ejj!Z"ejj#Z$ee ej%j&fe'e(e(e'e'ej%j)e(dœdd„Z*eefe(e'e'e(dœdd	„Z+dS )
é    Né   )Ú_argon2)ÚsizeÚpasswordÚsaltÚopslimitÚmemlimitÚencoderÚreturnc              
   C   s   |  tj | ||||t¡¡S )aŒ  
    Derive a ``size`` bytes long key from a caller-supplied
    ``password`` and ``salt`` pair using the argon2i
    memory-hard construct.

    the enclosing module provides the constants

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

    as a guidance for correct settings.

    :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
    )ÚencodeÚnaclÚbindingsZcrypto_pwhash_algÚALG)r   r   r   r   r   r	   © r   úP/var/www/html/myproject/myenv/lib/python3.8/site-packages/nacl/pwhash/argon2i.pyÚkdf1   s    5     ÿÿr   )r   r   r   r
   c                 C   s   t j | ||t¡S )a¯  
    Hashes a password with a random salt, using the memory-hard
    argon2i 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
    )r   r   Zcrypto_pwhash_str_algr   )r   r   r   r   r   r   Ústrm   s       ÿr   ),Znacl.bindingsr   Znacl.encodingÚ r   ZALG_ARGON2I13r   r   Zcrypto_pwhash_argon2i_STRPREFIXZ	STRPREFIXZ	SALTBYTESZ
PASSWD_MINZ
PASSWD_MAXZPWHASH_SIZEZ	BYTES_MINZ	BYTES_MAXÚverifyZ"crypto_pwhash_argon2i_MEMLIMIT_MAXZMEMLIMIT_MAXZ"crypto_pwhash_argon2i_MEMLIMIT_MINZMEMLIMIT_MINZ"crypto_pwhash_argon2i_OPSLIMIT_MAXZOPSLIMIT_MAXZ"crypto_pwhash_argon2i_OPSLIMIT_MINZOPSLIMIT_MINZ*crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVEZOPSLIMIT_INTERACTIVEZ*crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVEZMEMLIMIT_INTERACTIVEZ(crypto_pwhash_argon2i_OPSLIMIT_SENSITIVEZOPSLIMIT_SENSITIVEZ(crypto_pwhash_argon2i_MEMLIMIT_SENSITIVEZMEMLIMIT_SENSITIVEZ'crypto_pwhash_argon2i_OPSLIMIT_MODERATEZOPSLIMIT_MODERATEZ'crypto_pwhash_argon2i_MEMLIMIT_MODERATEZMEMLIMIT_MODERATEÚencodingZ
RawEncoderÚintÚbytesZEncoderr   r   r   r   r   r   Ú<module>   sR   úù>ýü