%PDF- %PDF-
| Direktori : /lib/python3.9/site-packages/passlib/handlers/__pycache__/ |
| Current File : //lib/python3.9/site-packages/passlib/handlers/__pycache__/md5_crypt.cpython-39.pyc |
a
f�Wc�5 � @ s� d Z ddlmZ ddlZe�e�ZddlmZm Z m
Z
ddlmZ ddl
mZmZ ddlm mZ ddgZd Zd
ZdZdZd
Zddd�ZG dd� dejej�ZG dd� deje�ZG dd� de�Z dS )z0passlib.handlers.md5_crypt - md5-crypt algorithm� )�md5N)�
safe_crypt�
test_crypt�
repeat_string)�h64)�unicode�u� md5_crypt�
apr_md5_crypt� s $1$s $apr1$))r � �� � �r r )r � r
r �r r )� r r r )r r r r r
)r r r r
)r r r r
r )� � r �
� r � � r � � r r �
r � Fc s� t | t�r| �d�} t | t�s&J d��t| v r:tj�t��t | �}t |t�sTJ d��|�d�}t |�dk srJ d��|r|t
}nt}t| | | ��
� }t| | | �}|j}|t||�� |}| dd� } |r�||d@ r�tn| � |dL }q�|�
� }
| | }| | }| |||| || || g� � fd d
�tD �}
|
}d}|�rv|
D ]&\}}t|t|| ��
� ��
� }�qB|d8 }�q8|
dd� D ]&\}}t|t|| ��
� ��
� }�q�t�|t��d�S )
a� perform raw md5-crypt calculation
this function provides a pure-python implementation of the internals
for the MD5-Crypt algorithms; it doesn't handle any of the
parsing/validation of the hash strings themselves.
:arg pwd: password chars/bytes to hash
:arg salt: salt chars to use
:arg use_apr: use apache variant
:returns:
encoded checksum chars
zutf-8zpwd not unicode or byteszsalt not unicode�asciir zsalt too largeNr c s g | ]\}}� | � | f�qS � r )�.0�even�odd�Zpermsr �>/usr/lib/python3.9/site-packages/passlib/handlers/md5_crypt.py�
<listcomp>� � z"_raw_md5_crypt.<locals>.<listcomp>� � )�
isinstancer �encode�bytes�_BNULL�uh�excZNullPasswordErrorr �len�
_APR_MAGIC�
_MD5_MAGICr �digest�updater �_c_digest_offsetsr Zencode_transposed_bytes�_transpose_map�decode)�pwd�salt�use_aprZpwd_len�magicZdbZa_ctxZa_ctx_update�iZevenchar�daZpwd_pwdZpwd_salt�dataZdcZblocksr! r"