%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__/mysql.cpython-39.pyc

a

f�Wc��@s�dZddlmZddlZddlZe�e�Zddlm	Z	ddl
mZddlm
Z
mZmZmZmZddlmmZddgZGd	d�dej�ZGd
d�dej�ZdS)a8passlib.handlers.mysql

MySQL 3.2.3 / OLD_PASSWORD()

    This implements Mysql's OLD_PASSWORD algorithm, introduced in version 3.2.3, deprecated in version 4.1.

    See :mod:`passlib.handlers.mysql_41` for the new algorithm was put in place in version 4.1

    This algorithm is known to be very insecure, and should only be used to verify existing password hashes.

    http://djangosnippets.org/snippets/1508/

MySQL 4.1.1 / NEW PASSWORD
    This implements Mysql new PASSWORD algorithm, introduced in version 4.1.

    This function is unsalted, and therefore not very secure against rainbow attacks.
    It should only be used when dealing with mysql passwords,
    for all other purposes, you should use a salted hash function.

    Description taken from http://dev.mysql.com/doc/refman/6.0/en/password-hashing.html
�)�sha1N)�warn)�
to_native_str)�
bascii_to_str�unicode�u�byte_elem_value�
str_to_uascii�mysql323Zmysq41c@s2eZdZdZdZdZejZe	dd��Z
dd�ZdS)r
aThis class implements the MySQL 3.2.3 password hash, and follows the :ref:`password-hash-api`.

    It has no salt and a single fixed round.

    The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept no optional keywords.
    �cCs|��S�N)�lower��cls�hash�r�:/usr/lib/python3.9/site-packages/passlib/handlers/mysql.py�
_norm_hash>szmysql323._norm_hashc
Cs�t|t�r|�d�}d}d}d}d}d}d}|D]V}||vr>q0t|�}	||d@||	|d	>|@N}||d	>|A|@}||	|@}q0td
�||@||@fS)N�utf-8l��i���s 	i5W0PiqV4��?�z%08x%08x)�
isinstancer�encoderr)
�self�secretZMASK_32ZMASK_31ZWHITEZnr1Znr2�add�c�tmprrr�_calc_checksumBs 

 zmysql323._calc_checksumN)�__name__�
__module__�__qualname__�__doc__�name�
checksum_size�uh�	HEX_CHARS�checksum_chars�classmethodrrrrrrr
-s	
c@s:eZdZdZdZed�ZejZ	dZ
edd��Zdd�Z
dS)	�mysql41aThis class implements the MySQL 4.1 password hash, and follows the :ref:`password-hash-api`.

    It has no salt and a single fixed round.

    The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept no optional keywords.
    �*�(cCs|��Sr)�upperrrrrrpszmysql41._norm_hashcCs0t|t�r|�d�}ttt|���������S)Nr)rrrr	r�digest�	hexdigestr-)rrrrrrts

zmysql41._calc_checksumN)r r!r"r#r$rZ_hash_prefixr&r'r(r%r)rrrrrrr*^s	
r*)r#Zhashlibr�reZloggingZ	getLoggerr �log�warningsrZ
passlib.utilsrZpasslib.utils.compatrrrrr	Zpasslib.utils.handlersZutils�handlersr&�__all__Z
StaticHandlerr
r*rrrr�<module>s�1

Zerion Mini Shell 1.0