blob: 27bcb4bd69ea790aa2c5fcae633d9bbd6fe6d92d (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
============================================
:mod:`passlib.hash` - Password Hash Schemes
============================================
.. module:: passlib.hash
:synopsis: all password hashes provided by PassLib
This module contains classes implementing each of the password hashes built into
passlib. As well, any external hashes registered using :func:`register_crypt_handler`
will be inserted into this module.
Each class within this package implements a single password hashing scheme,
and follows passlib's :ref:`password-hash-api`.
While many applications may find it easier to use a :class:`CryptContext`
instance, or retreive handlers via :func:`get_crypt_handler`, they can
also be imported and used directly from this package, as in the following example:
>>> from passlib.hash import md5_crypt
>>> hash = md5_crypt.encrypt("password")
PassLib contains the following builtin password algorithms:
Archaic Unix Schemes
--------------------
All these schemes are/were used by various unix flavors to store user passwords;
most are based on the DES block cipher,
and predate the arrival of the :ref:`modular crypt format <modular-crypt-format>`.
There are all considered insecure (at best), but may be useful when reading
legacy password entries:
.. toctree::
:maxdepth: 1
passlib.hash.des_crypt
passlib.hash.bsdi_crypt
passlib.hash.bigcrypt
passlib.hash.crypt16
Standard Unix Schemes
---------------------
All these schemes are currently used by various unix flavors to store user passwords.
They all follow the :ref:`modular crypt format <modular-crypt-format>` for encoding idenfiable hashes.
.. toctree::
:maxdepth: 1
passlib.hash.md5_crypt
passlib.hash.bcrypt
passlib.hash.sha1_crypt
passlib.hash.sun_md5_crypt
passlib.hash.sha256_crypt
passlib.hash.sha512_crypt
Non-Standard Unix-Compatible Schemes
------------------------------------
While most of these schemes are not commonly used by any unix flavor to store user passwords,
these are compatible with the :ref:`modular crypt format <modular-crypt-format>`, and can be
used in contexts which support them, in parallel with the others following
the modular crypt format.
.. toctree::
:maxdepth: 1
passlib.hash.apr_md5_crypt
passlib.hash.phpass
passlib.hash.nthash
Database Schemes
----------------
The following schemes are used by various SQL databases
to encode their own user accounts.
These schemes have encoding and contextual requirements
not seen outside those specific contexts:
.. toctree::
:maxdepth: 1
passlib.hash.mysql323
passlib.hash.mysql41
passlib.hash.postgres_md5
passlib.hash.oracle10
passlib.hash.oracle11
Other Schemes
-------------
The following schemes are used in various contexts,
mainly for legacy compatibility purposes.
.. toctree::
:maxdepth: 1
passlib.hash.hex_digests
passlib.hash.ldap_digests
passlib.hash.plaintext
passlib.hash.unix_fallback
|