Ñò
§ÚêLc @ sQ d Z d d k Z d d k Z d d k l Z d d k l Z e i e i d Z d e d d ƒ f d „ ƒ YZ
d d „ Z d d
„ Z
e
d d d d
ƒ Z e
d d d d ƒ Z e
d d d d ƒ Z e
d d d d ƒ Z g Z xT e e e f D]C Z e
d e ƒ Z e o' e e ƒ e i j o e i e ƒ qó qó We i e ƒ [ [ d S( s» Wrapper to the POSIX crypt library call and associated functionality.
Note that the ``methods`` and ``METHOD_*`` attributes are non-standard
extensions to Python 2.6, backported from 3.3iÿÿÿÿN( t choice( t
namedtuples ./t _Methods name ident salt_chars total_sizec B s e Z d Z d „ Z RS( si Class representing a salt method per the Modular Crypt Format or the
legacy 2-character crypt method.c C s d | i S( Ns ( t name( t self( ( s /usr/lib64/python2.6/crypt.pyt __repr__ s ( t __name__t
__module__t __doc__R ( ( ( s /usr/lib64/python2.6/crypt.pyR s c C sc | d j o t d } n | i o d | i n d } | d i d „ t | i ƒ Dƒ ƒ 7} | S( s» Generate a salt for the specified method.
If not specified, the strongest available method will be used.
This is a non-standard extension to Python 2.6, backported from 3.3
i s $%s$t c s s x | ] } t t ƒ Vq Wd S( N( R t
_saltchars( t .0t _( ( s /usr/lib64/python2.6/crypt.pys # s N( t Nonet methodst identt joint ranget
salt_chars( t methodt s( ( s /usr/lib64/python2.6/crypt.pyt mksalt s
&c C s= | d j p t | t ƒ o t | ƒ } n t i | | ƒ S( sN Return a string representing the one-way hash of a password, with a salt
prepended.
If ``salt`` is not specified or is ``None``, the strongest
available method will be selected and a salt generated. Otherwise,
``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as
returned by ``crypt.mksalt()``.
Note that these are non-standard extensions to Python 2.6's crypt.crypt()
entrypoint, backported from 3.3: the standard Python 2.6 crypt.crypt()
entrypoint requires two strings as the parameters, and does not support
keyword arguments.
N( R
t
isinstanceR R t _cryptt crypt( t wordt salt( ( s /usr/lib64/python2.6/crypt.pyR ' s t CRYPTi i
t MD5t 1i i" t SHA256t 5i i? t SHA512t 6ij R ( R R t stringt randomR t collectionsR t
ascii_letterst digitsR
R R
R R t METHOD_CRYPTt
METHOD_MD5t
METHOD_SHA256t
METHOD_SHA512R t _methodt _resultt lent
total_sizet append( ( ( s /usr/lib64/python2.6/crypt.pyt s(