a fWc@stdZddlmZddlZeeZddlmZddl m Z m Z m Z ddl mmZdgZGdddejejZdS)zXpasslib.handlers.postgres_md5 - MD5-based algorithm used by Postgres for pg_shadow table)md5N)to_bytes) str_to_uasciiunicodeu postgres_md5c@s.eZdZdZdZedZejZ dZ ddZ dS)raThis 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 cCs8t|tr|d}t|jddd}tt||S)Nzutf-8user)Zparam) isinstancerencoderr rr hexdigest)selfZsecretr r=/usr/lib/python3.9/site-packages/passlib/handlers/postgres.py_calc_checksum+s  zpostgres_md5._calc_checksumN) __name__ __module__ __qualname____doc__namerZ _hash_prefixuhZ HEX_CHARSZchecksum_charsZ checksum_sizerrrrrrs  )rZhashlibrZloggingZ getLoggerrlogZ passlib.utilsrZpasslib.utils.compatrrrZpasslib.utils.handlersZutilshandlersr__all__ZHasUserContextZ StaticHandlerrrrrrs