summaryrefslogtreecommitdiff
path: root/docs/lib/passlib.utils.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/lib/passlib.utils.rst')
-rw-r--r--docs/lib/passlib.utils.rst67
1 files changed, 66 insertions, 1 deletions
diff --git a/docs/lib/passlib.utils.rst b/docs/lib/passlib.utils.rst
index 580c830..b052f5a 100644
--- a/docs/lib/passlib.utils.rst
+++ b/docs/lib/passlib.utils.rst
@@ -50,6 +50,72 @@ Bytes Manipulation
.. autofunction:: xor_bytes
.. autofunction:: consteq
+Base64 Encoding
+===============
+
+Base64Engine Class
+------------------
+Passlib has to deal with a number of different Base64 encodings,
+with varying endianness, as well as wildly different value <-> character
+mappings. This is all encapsulated in the :class:`Base64Engine` class,
+which provides common encoding actions for an arbitrary base64-style encoding
+scheme. There are also a couple of predefined instances which are commonly
+used by the hashes in Passlib.
+
+.. autoclass:: Base64Engine
+
+Common Character Maps
+---------------------
+.. data:: BASE64_CHARS
+
+ Character map used by standard MIME-compatible Base64 encoding scheme.
+
+.. data:: HASH64_CHARS
+
+ Base64 character map used by a number of hash formats;
+ the ordering is wildly different from the standard base64 character map.
+ (see :data:`h64` for details).
+
+.. data:: BCRYPT_CHARS
+
+ Base64 character map used by :class:`~passlib.hash.bcrypt`.
+ The ordering is wildly different from both the standard base64 character map,
+ and the common hash64 character map.
+
+Predefined Instances
+--------------------
+.. data:: h64
+ Predefined instance of :class:`Base64Engine` which uses
+ the :data:`HASH64_CHARS` character map and little-endian encoding.
+
+ This encoding system appears to have originated with
+ :class:`~passlib.hash.des_crypt`, but is used by
+ :class:`~passlib.hash.md5-crypt`, `~passlib.hash.sha256_crypt`,
+ and others. Within Passlib, this encoding is referred as ``hash64`` encoding
+ to distinguish it from normal base64 and other encodings.
+
+.. data:: h64big
+ Predefined variant of :data:`h64` which uses big-endian encoding.
+ This is mainly used by :class:`~passlib.hash.des_crypt`.
+
+.. note::
+
+ *changed in Passlib 1.6:* the :mod:`passlib.utils.h64` module used by
+ Passlib <= 1.5 has been replaced by the the ``h64`` and ``h64big``
+ instances; but the interface remains mostly unchanged.
+
+..
+
+ .. data:: AB64_CHARS
+
+ Variant of standard Base64 character map used by some
+ custom Passlib hashes (see :func:`ab64_encode`).
+
+ Other
+ -----
+ .. autofunction:: ab64_encode
+ .. autofunction:: ab64_decode
+
Randomness
==========
.. data:: rng
@@ -83,7 +149,6 @@ There are also a few sub modules which provide additional utility functions:
:maxdepth: 1
passlib.utils.des
- passlib.utils.h64
passlib.utils.md4
passlib.utils.pbkdf2
passlib.utils.handlers