o
    5h                     @   st   d Z ddlmZ ddlZeeZddlmZ ddl	m
Z
mZmZ ddlm  mZ dgZG dd dejejZdS )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 Zd ZdZd ZedZejZ	dZ
dd ZdS )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| jddd}tt||  S )Nzutf-8user)param)
isinstancer   encoder   r	   r   r   	hexdigest)selfsecretr	    r   m/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/passlib/handlers/postgres.py_calc_checksum+   s   

zpostgres_md5._calc_checksumN)__name__
__module____qualname____doc__namer   _hash_prefixuh	HEX_CHARSchecksum_charschecksum_sizer   r   r   r   r   r      s    )r   hashlibr   logging	getLoggerr   logpasslib.utilsr   passlib.utils.compatr   r   r   passlib.utils.handlersutilshandlersr   __all__HasUserContextStaticHandlerr   r   r   r   r   <module>   s    