
    g                         S r SSKJr  SSKr\R                  " \5      rSSKJr  SSK	J
r
JrJr  SSKJs  Jr  S/r " S S\R$                  \R&                  5      rg)zXpasslib.handlers.postgres_md5 - MD5-based algorithm used by Postgres for pg_shadow table    )md5N)to_bytes)str_to_uasciiunicodeupostgres_md5c                   N    \ rS rSrSrS r\" S5      r\R                  r
SrS rSrg)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                     [        U[        5      (       a  UR                  S5      n[        U R                  SSS9n[        [        X-   5      R                  5       5      $ )Nzutf-8user)param)
isinstancer   encoder   r   r   r   	hexdigest)selfsecretr   s      R/home/matz/Project1/venv/lib/python3.13/site-packages/passlib/handlers/postgres.py_calc_checksumpostgres_md5._calc_checksum+   sJ    fg&&]]7+F		7&9S/99;<<     N)__name__
__module____qualname____firstlineno____doc__namer   _hash_prefixuh	HEX_CHARSchecksum_charschecksum_sizer   __static_attributes__r   r   r   r   r      s*    	 DU8L\\NM
=r   )r   hashlibr   logging	getLoggerr   logpasslib.utilsr   passlib.utils.compatr   r   r   passlib.utils.handlersutilshandlersr    __all__HasUserContextStaticHandlerr   r   r   r   <module>r1      sV    ^
  g''1 # : : # # =2$$b&6&6 =r   