summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/lib/passlib.context.rst12
-rw-r--r--docs/lib/passlib.utils.handlers.rst4
-rw-r--r--docs/password_hash_api.rst18
3 files changed, 30 insertions, 4 deletions
diff --git a/docs/lib/passlib.context.rst b/docs/lib/passlib.context.rst
index 312f55c..a85ba52 100644
--- a/docs/lib/passlib.context.rst
+++ b/docs/lib/passlib.context.rst
@@ -153,6 +153,18 @@ Options which directly affect the behavior of the CryptContext instance:
.. seealso:: :ref:`context-migration-example` in the tutorial
+:samp:`truncate_error`
+
+ By default, some algorithms will truncate large passwords
+ (e.g. :class:`~passlib.hash.bcrypt` truncates ones larger than 72 bytes).
+ Such hashes accept a ``truncate_error=True`` option to make them
+ raise a :exc:`~passlib.exc.PasswordTruncateError` instead.
+
+ This can also be set at the CryptContext level,
+ and will passed to all hashes that support it.
+
+ .. versionadded:: 1.7
+
.. _context-min-verify-time-option:
``min_verify_time``
diff --git a/docs/lib/passlib.utils.handlers.rst b/docs/lib/passlib.utils.handlers.rst
index aad970a..1c55158 100644
--- a/docs/lib/passlib.utils.handlers.rst
+++ b/docs/lib/passlib.utils.handlers.rst
@@ -178,10 +178,6 @@ of the unittest for :class:`passlib.hash.des_crypt`::
# [required] - store the handler object itself in the handler attribute
handler = des_crypt
- # [optional] - if your hash only uses the first X characters of the password,
- # set that value here. otherwise leave the default (-1).
- secret_size = 8
-
# [required] - this should be a list of (password, hash) pairs,
# which should all verify correctly using your handler.
# it is recommend include pairs which test all of the following:
diff --git a/docs/password_hash_api.rst b/docs/password_hash_api.rst
index 030f17a..a10396e 100644
--- a/docs/password_hash_api.rst
+++ b/docs/password_hash_api.rst
@@ -574,6 +574,14 @@ the hashes in passlib:
revision of the hash algorithm itself, and they may not all
offer the same level of security.
+ ``truncate_error``
+
+ This will be present if and only if the hash truncates passwords
+ larger than some limit (reported via it's :attr:`truncate_size` attribute).
+ By default, they will silently truncate passwords above their limit.
+ Setting ``truncate_error=True`` will cause :meth:`~passlib.ifc.PasswordHash.hash`
+ to raise a :exc:`~passlib.exc.PasswordTruncateError` instead.
+
.. index::
single: relaxed; PasswordHash keyword
@@ -634,6 +642,16 @@ the hashes in passlib:
their default encoding programmatically via the
:attr:`~PasswordHash.default_encoding` attribute.
+.. attribute:: truncate_size
+
+ A positive integer, indicating the hash will truncate any passwords larger than this many bytes.
+ If ``None`` (the more common case), indicates the hash will use
+ the entire password provided.
+
+ Hashes which specify this setting will also support a ``truncate_error``
+ flag via their :meth:`~PasswordHash.using` method, to configure
+ how truncation is handled.
+
.. _salt-attributes:
Salt Information