summaryrefslogtreecommitdiff
path: root/passlib/crypto
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2016-11-20 14:11:35 -0500
committerEli Collins <elic@assurancetechnologies.com>2016-11-20 14:11:35 -0500
commita54c5ba533592f7113fd3a4a86bf8a036baa7860 (patch)
tree1c36f1329efb86a637ff365c3e7a6a8819ed3cc5 /passlib/crypto
parentb214f86b7523f3adaf8bdcf78ffbddf351c0fb3d (diff)
downloadpasslib-a54c5ba533592f7113fd3a4a86bf8a036baa7860.tar.gz
docs: LARGE update to documentation, tutorials added, pages relocated
* moved a bunch of pages into 'docs/narr' narrative subsection. added placeholder pages in old locations, to minimize inbound link breakage. * split history into separate pages, was getting way too long. removed toplevel CHANGES file, not feasible under new structure. * passlib.ifc split into reference & tutorial portions, tutorial allowed subsuming a bunch of other hash-usage examples. * added standard fragments for warning about insecure hashes, added them to top of a LOT of hash doc pages. * updated references, various layout tweaks
Diffstat (limited to 'passlib/crypto')
-rw-r--r--passlib/crypto/digest.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/passlib/crypto/digest.py b/passlib/crypto/digest.py
index 78c2ad4..2d8006a 100644
--- a/passlib/crypto/digest.py
+++ b/passlib/crypto/digest.py
@@ -207,18 +207,22 @@ def lookup_hash(digest, return_unknown=False):
Can be used to look up a hash constructor by name, normalize hash name representation, etc.
:arg digest:
- A string containing a :mod:`!hashlib` digest name (e.g. ``"sha256"``),
- an IANA-assigned hash name, or even a digest constructor (e.g. :func:`hashlib.sha256`).
+ This can be any of:
+
+ * A string containing a :mod:`!hashlib` digest name (e.g. ``"sha256"``),
+ * A string containing an IANA-assigned hash name,
+ * A digest constructor function (e.g. ``hashlib.sha256``).
+
Case is ignored, underscores are converted to hyphens,
and various other cleanups are made.
:param return_unknown:
- By default, this function will throw a :exc:`~passlib.exc.KnownHashError` if no hash constructor
+ By default, this function will throw an :exc:`~passlib.exc.UnknownHashError` if no hash constructor
can be found. However, if this flag is False, it will instead return a dummy record
without a constructor function. This is mainly used by :func:`norm_hash_name`.
:returns HashInfo:
- :class:`!HashInfo` instance containing information about specified digest.
+ :class:`HashInfo` instance containing information about specified digest.
Multiple calls resolving to the same hash should always
return the same :class:`!HashInfo` instance.
@@ -323,8 +327,8 @@ def norm_hash_name(name, format="hashlib"):
with Python's :mod:`!hashlib`.
* ``"iana"`` - normalizes name to IANA-assigned hash function name.
- for hashes which IANA hasn't assigned a name for, issues a warning,
- and then uses a heuristic to give a "best guess".
+ For hashes which IANA hasn't assigned a name for, this issues a warning,
+ and then uses a heuristic to return a "best guess" name.
:returns:
Hash name, returned as native :class:`!str`.