summaryrefslogtreecommitdiffstats
path: root/Doc/library/crypt.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-11-16 11:22:51 (GMT)
committerGitHub <noreply@github.com>2017-11-16 11:22:51 (GMT)
commitcede8c9edb408321b493d8d5e73be9e1018020e4 (patch)
tree4fe1a839627257c155760f83bad2923aac749834 /Doc/library/crypt.rst
parentccb0442a338066bf40fe417455e5a374e5238afb (diff)
downloadcpython-cede8c9edb408321b493d8d5e73be9e1018020e4.zip
cpython-cede8c9edb408321b493d8d5e73be9e1018020e4.tar.gz
cpython-cede8c9edb408321b493d8d5e73be9e1018020e4.tar.bz2
bpo-31702: Allow to specify rounds for SHA-2 hashing in crypt.mksalt(). (#4110)
The log_rounds parameter for Blowfish has been replaced with the rounds parameter.
Diffstat (limited to 'Doc/library/crypt.rst')
-rw-r--r--Doc/library/crypt.rst14
1 files changed, 9 insertions, 5 deletions
diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst
index 9877b71..dd62cb3 100644
--- a/Doc/library/crypt.rst
+++ b/Doc/library/crypt.rst
@@ -116,7 +116,7 @@ The :mod:`crypt` module defines the following functions:
Accept ``crypt.METHOD_*`` values in addition to strings for *salt*.
-.. function:: mksalt(method=None, *, log_rounds=12)
+.. function:: mksalt(method=None, *, rounds=None)
Return a randomly generated salt of the specified method. If no
*method* is given, the strongest method available as returned by
@@ -125,14 +125,18 @@ The :mod:`crypt` module defines the following functions:
The return value is a string suitable for passing as the *salt* argument
to :func:`crypt`.
- *log_rounds* specifies the binary logarithm of the number of rounds
- for ``crypt.METHOD_BLOWFISH``, and is ignored otherwise. ``8`` specifies
- ``256`` rounds.
+ *rounds* specifies the number of rounds for ``METHOD_SHA256``,
+ ``METHOD_SHA512`` and ``METHOD_BLOWFISH``.
+ For ``METHOD_SHA256`` and ``METHOD_SHA512`` it must be an integer between
+ ``1000`` and ``999_999_999``, the default is ``5000``. For
+ ``METHOD_BLOWFISH`` it must be a power of two between ``16`` (2\ :sup:`4`)
+ and ``2_147_483_648`` (2\ :sup:`31`), the default is ``4096``
+ (2\ :sup:`12`).
.. versionadded:: 3.3
.. versionchanged:: 3.7
- Added the *log_rounds* parameter.
+ Added the *rounds* parameter.
Examples