관리-도구
편집 파일: md5_crypt.cpython-39.opt-1.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| v r(tj�t��t| �}|�d�}|rDt }nt }t| | | ��� }t| | | �}|j }|t||�� |}| dd� } |r�||d@ r�tn| � |dL }q�|�� } | | }| | }| |||| || || g� � fdd�tD �} | }d}|�r>| D ]&\}}t|t|| ��� ��� }�q |d8 }�q | dd� D ]&\}}t|t|| ��� ��� }�qJt�|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-8�asciiNr 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�_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"