Current File : //usr/lib/python2.7/site-packages/passlib/ifc.pyo |
�
���Xc @ s� d Z d d l Z e j e � Z d d l Z d d l m Z d g Z d � Z d d l
m Z m Z m
Z
e e � d e f d � � Y� Z d e f d � � YZ d S(
s1 passlib.ifc - abstract interfaces used by Passlibi����N( t deprecated_methodt PasswordHashc s � f d � } | S( s5 class decorator that re-creates class using metaclassc s5 � t | � k r | S� | j | j | j j � � S( N( t typet __name__t __bases__t __dict__t copy( t cls( t meta( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt builder s ( ( R R ( ( R s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt recreate_with_metaclass s ( t ABCMetat abstractmethodt abstractpropertyc B s e Z d Z e Z d Z e Z e Z e
e d � � � Z e
d d d d d d � e
d � � � Z e
e d � � � Z e
e e d
� � � Z e
d d � � Z e
e d � � � Z e
d d d d � e
d
� � � Z e
d d d d � e
d � � � Z e Z RS( s� This 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.
c K s t d � � d S( 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).
s must be implemented by subclassN( t NotImplementedError( R t secrett setting_and_context_kwds( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt hashr s t
deprecateds 1.7t removeds 2.0t replacements .hash()c O s | 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 ( R t argst kwds( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt encrypt� s c K s t d � � d S( s. verify secret against hash, returns True/Falses must be implemented by subclassN( R ( R R R t context_kwds( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt verify� s c K s t d � � d S( 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.
s must be implemented by subclassN( R ( R t relaxedR ( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt using� s c C s t S( 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
( t False( R R R ( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt needs_update� s c C s t d � � d S( s8 check if hash belongs to this scheme, returns True/Falses must be implemented by subclassN( R ( R R ( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt identify� s c K s. | j r t d � � n | j | � j d � S( 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.
s must be implemented by subclasst ( R R R R ( R t setting_kwds( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt genconfig� s c K s t d � � d S( 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.
s must be implemented by subclassN( R ( R R t configt context( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt genhash� s
N( R t
__module__t __doc__R t is_disabledt Nonet
truncate_sizet Truet truncate_errort truncate_verify_rejectt classmethodR R R R R R R R R! R$ R ( ( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyR % s.
!t DisabledHashc B s5 e Z d Z e Z e d d � � Z e d � � Z RS( sR
extended disabled-hash methods; only need be present if .disabled = True
c C s
| j d � S( s�
return string representing a 'disabled' hash;
optionally including previously enabled hash
(this is up to the individual scheme).
R ( R ( R R ( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt disableK s c C s t d � � d S( s�
given a disabled-hash string,
extract previously-enabled hash if one is present,
otherwise raises ValueError
s cannot restore original hashN( t
ValueError( R R ( ( s/ /usr/lib/python2.7/site-packages/passlib/ifc.pyt enableU s N( R R% R&