관리-도구
편집 파일: postgres.cpython-39.opt-1.pyc
a f�Wc� � @ st d Z ddlmZ ddlZe�e�ZddlmZ ddl m Z mZmZ ddl m mZ dgZG dd� dejej�ZdS )zXpasslib.handlers.postgres_md5 - MD5-based algorithm used by Postgres for pg_shadow table� )�md5N)�to_bytes)� str_to_uascii�unicode�u�postgres_md5c @ s. e Zd ZdZd Zed�ZejZ dZ dd� ZdS )r a� This class implements the Postgres MD5 Password hash, and follows the :ref:`password-hash-api`. It does a single round of hashing, and relies on the username as the salt. The :meth:`~passlib.ifc.PasswordHash.hash`, :meth:`~passlib.ifc.PasswordHash.genhash`, and :meth:`~passlib.ifc.PasswordHash.verify` methods all require the following additional contextual keywords: :type user: str :param user: name of postgres user account this password is associated with. r � c C s8 t |t�r|�d�}t| jddd�}tt|| ��� �S )Nzutf-8�user)Zparam)� isinstancer �encoder r r r � hexdigest)�selfZsecretr � r �=/usr/lib/python3.9/site-packages/passlib/handlers/postgres.py�_calc_checksum+ s zpostgres_md5._calc_checksumN)�__name__� __module__�__qualname__�__doc__�namer Z_hash_prefix�uhZ HEX_CHARSZchecksum_charsZ checksum_sizer r r r r r s )r Zhashlibr ZloggingZ getLoggerr �logZ passlib.utilsr Zpasslib.utils.compatr r r Zpasslib.utils.handlersZutils�handlersr �__all__ZHasUserContextZ StaticHandlerr r r r r �<module> s �