Xc@sdZddlZejeZddlZddlmZdgZdZ ddl m Z m Z m Z e e defdYZdefd YZdS( s1passlib.ifc - abstract interfaces used by PasslibiN(tdeprecated_methodt PasswordHashcsfd}|S(s5class decorator that re-creates class using metaclasscs5t|kr|S|j|j|jjS(N(ttypet__name__t __bases__t__dict__tcopy(tcls(tmeta(s//usr/lib/python2.7/site-packages/passlib/ifc.pytbuilders((RR ((Rs//usr/lib/python2.7/site-packages/passlib/ifc.pytrecreate_with_metaclasss(tABCMetatabstractmethodtabstractpropertycBseZdZeZdZeZeZ e e dZ e dddddde dZe e d Ze e ed Ze dd Ze e d Ze dddde d Ze dddde dZeZRS(sThis class describes an abstract interface which all password hashes in Passlib adhere to. Under Python 2.6 and up, this is an actual Abstract Base Class built using the :mod:`!abc` module. See the Passlib docs for full documentation. cKstddS(s  Hash secret, returning result. Should handle generating salt, etc, and should return string containing identifier, salt & other configuration, as well as digest. :param \*\*settings_kwds: Pass in settings to customize configuration of resulting hash. .. deprecated:: 1.7 Starting with Passlib 1.7, callers should no longer pass settings keywords (e.g. ``rounds`` or ``salt`` directly to :meth:`!hash`); should use ``.using(**settings).hash(secret)`` construction instead. Support will be removed in Passlib 2.0. :param \*\*context_kwds: Specific algorithms may require context-specific information (such as the user login). smust be implemented by subclassN(tNotImplementedError(Rtsecrettsetting_and_context_kwds((s//usr/lib/python2.7/site-packages/passlib/ifc.pythashrst deprecateds1.7tremoveds2.0t replacements.hash()cOs|j||S(s Legacy alias for :meth:`hash`. .. deprecated:: 1.7 This method was renamed to :meth:`!hash` in version 1.7. This alias will be removed in version 2.0, and should only be used for compatibility with Passlib 1.3 - 1.6. (R(Rtargstkwds((s//usr/lib/python2.7/site-packages/passlib/ifc.pytencrypts cKstddS(s.verify secret against hash, returns True/Falsesmust be implemented by subclassN(R(RRRt context_kwds((s//usr/lib/python2.7/site-packages/passlib/ifc.pytverifyscKstddS(s Return another hasher object (typically a subclass of the current one), which integrates the configuration options specified by ``kwds``. This should *always* return a new object, even if no configuration options are changed. .. todo:: document which options are accepted. :returns: typically returns a subclass for most hasher implementations. .. todo:: add this method to main documentation. smust be implemented by subclassN(R(RtrelaxedR((s//usr/lib/python2.7/site-packages/passlib/ifc.pytusingscCstS(s check if hash's configuration is outside desired bounds, or contains some other internal option which requires updating the password hash. :param hash: hash string to examine :param secret: optional secret known to have verified against the provided hash. (this is used by some hashes to detect legacy algorithm mistakes). :return: whether secret needs re-hashing. .. versionadded:: 1.7 (tFalse(RRR((s//usr/lib/python2.7/site-packages/passlib/ifc.pyt needs_updatescCstddS(s8check if hash belongs to this scheme, returns True/Falsesmust be implemented by subclassN(R(RR((s//usr/lib/python2.7/site-packages/passlib/ifc.pytidentifyscKs.|jrtdn|j|jdS(s compile settings into a configuration string for genhash() .. deprecated:: 1.7 As of 1.7, this method is deprecated, and slated for complete removal in Passlib 2.0. For all known real-world uses, hashing a constant string should provide equivalent functionality. This deprecation may be reversed if a use-case presents itself in the mean time. smust be implemented by subclasst(RRRR(Rt setting_kwds((s//usr/lib/python2.7/site-packages/passlib/ifc.pyt genconfigs cKstddS(s1 generated hash for secret, using settings from config/hash string .. deprecated:: 1.7 As of 1.7, this method is deprecated, and slated for complete removal in Passlib 2.0. This deprecation may be reversed if a use-case presents itself in the mean time. smust be implemented by subclassN(R(RRtconfigtcontext((s//usr/lib/python2.7/site-packages/passlib/ifc.pytgenhashs N(Rt __module__t__doc__Rt is_disabledtNonet truncate_sizetTruettruncate_errorttruncate_verify_rejectt classmethodR RRRRRRRR!R$R(((s//usr/lib/python2.7/site-packages/passlib/ifc.pyR%s.  !t DisabledHashcBs5eZdZeZeddZedZRS(sR extended disabled-hash methods; only need be present if .disabled = True cCs |jdS(s return string representing a 'disabled' hash; optionally including previously enabled hash (this is up to the individual scheme). R(R(RR((s//usr/lib/python2.7/site-packages/passlib/ifc.pytdisableKscCstddS(s given a disabled-hash string, extract previously-enabled hash if one is present, otherwise raises ValueError scannot restore original hashN(t ValueError(RR((s//usr/lib/python2.7/site-packages/passlib/ifc.pytenableUsN( RR%R&R*R'R-R(R/R1(((s//usr/lib/python2.7/site-packages/passlib/ifc.pyR.Ds  (R&tloggingt getLoggerRtlogtsystpasslib.utils.decorRt__all__R tabcR R R tobjectRR.(((s//usr/lib/python2.7/site-packages/passlib/ifc.pyts