1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
==================================================================
:class:`passlib.hash.unix_disabled` - Unix Disabled Account Helper
==================================================================
.. currentmodule:: passlib.hash
This class does not provide an encryption scheme,
but instead provides a helper for handling disabled
password fields as found in unix ``/etc/shadow`` files.
This class is mainly useful only for plugging into a
:class:`~passlib.context.CryptContext` instance.
It can be used directly as follows::
>>> from passlib.hash import unix_disabled
>>> # 'hashing' a password always results in "!" or "*"
>>> unix_disabled.hash("password")
'!'
>>> # verifying will fail for all passwords and hashes
>>> unix_disabled.verify("password", "!")
False
>>> unix_disabled.verify("letmein", "*NOPASSWORD*")
False
>>> # this class should identify all strings which aren't
>>> # valid Unix crypt() output, while leaving MCF hashes alone
>>> unix_disabled.identify('!')
True
>>> unix_disabled.identify('')
True
>>> unix_disabled.identify("$1$somehash")
False
Interface
=========
.. autoclass:: unix_disabled()
Deprecated Interface
====================
.. autoclass:: unix_fallback()
Deviations
==========
According to the Linux ``shadow`` man page, an empty string is treated
as a wildcard by Linux, allowing all passwords. For security purposes,
this behavior is NOT supported; empty strings are treated the same as ``!`` or ``*``.
|