diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2016-06-29 11:43:07 -0400 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2016-06-29 11:43:07 -0400 |
| commit | 501ee83d2602e497e704760c97b6916ef2633888 (patch) | |
| tree | cee41f6def33ce513c8bb40fea86dd3d6cf329b3 /docs/lib/passlib.context.rst | |
| parent | 165283cc679059ed16dbf38897bbe07f7ed163c3 (diff) | |
| download | passlib-501ee83d2602e497e704760c97b6916ef2633888.tar.gz | |
passlib.hash: Improved handling of hashes which truncate passwords
* Added PasswordHash.truncate_size info attribute, to detect hashes
which truncate the password.
* All such hashes (bcrypt, des_crypt, some others) now accept a "truncate_error"
option, allowing them to be switched from silent truncation to throwing
an error instead. This option is also supported by CryptContext.
* tests/HandlerCase:
- removed .secret_size config flag, can now just read handler.truncate_size instead.
- reworked truncation tests to use new API, and test 'truncate_error' policy support.
Diffstat (limited to 'docs/lib/passlib.context.rst')
| -rw-r--r-- | docs/lib/passlib.context.rst | 12 |
1 files changed, 12 insertions, 0 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`` |
