ó ö 5Xc@s›dZddlmZddlZejeƒZddlmZddl m Z m Z m Z ddl jjZdgZdejejfd„ƒYZdS(sXpasslib.handlers.postgres_md5 - MD5-based algorithm used by Postgres for pg_shadow tablei˙˙˙˙(tmd5N(tto_bytes(t str_to_uasciitunicodetut postgres_md5cBs8eZdZdZedƒZejZdZ d„Z RS(sé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. RRi cCsSt|tƒr!|jdƒ}nt|jdddƒ}tt||ƒjƒƒS(Nsutf-8tparamtuser(t isinstanceRtencodeRRRRt hexdigest(tselftsecretR((s=/usr/lib/python2.7/site-packages/passlib/handlers/postgres.pyt_calc_checksum+s( t__name__t __module__t__doc__tnameRt _hash_prefixtuht HEX_CHARStchecksum_charst checksum_sizeR (((s=/usr/lib/python2.7/site-packages/passlib/handlers/postgres.pyRs    (RthashlibRtloggingt getLoggerRtlogt passlib.utilsRtpasslib.utils.compatRRRtpasslib.utils.handlerstutilsthandlersRt__all__tHasUserContextt StaticHandlerR(((s=/usr/lib/python2.7/site-packages/passlib/handlers/postgres.pyts