summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-10-24 16:36:17 (GMT)
committerGitHub <noreply@github.com>2017-10-24 16:36:17 (GMT)
commiteab3ff72ebe79416cc032b8508ae13332955a157 (patch)
treeaa3c36c6d3cfc0720d1755d9d9a558c6dc86bad6 /Doc
parent831d61d56c5b0f15cfcfd5083638aa111cddb72b (diff)
downloadcpython-eab3ff72ebe79416cc032b8508ae13332955a157.zip
cpython-eab3ff72ebe79416cc032b8508ae13332955a157.tar.gz
cpython-eab3ff72ebe79416cc032b8508ae13332955a157.tar.bz2
bpo-31664: Add support for the Blowfish method in crypt. (#3854)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/crypt.rst29
-rw-r--r--Doc/whatsnew/3.7.rst6
2 files changed, 27 insertions, 8 deletions
diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst
index dbd4274..9877b71 100644
--- a/Doc/library/crypt.rst
+++ b/Doc/library/crypt.rst
@@ -41,17 +41,24 @@ are available on all platforms):
.. data:: METHOD_SHA512
A Modular Crypt Format method with 16 character salt and 86 character
- hash. This is the strongest method.
+ hash based on the SHA-512 hash function. This is the strongest method.
.. data:: METHOD_SHA256
Another Modular Crypt Format method with 16 character salt and 43
- character hash.
+ character hash based on the SHA-256 hash function.
+
+.. data:: METHOD_BLOWFISH
+
+ Another Modular Crypt Format method with 22 character salt and 31
+ character hash based on the Blowfish cipher.
+
+ .. versionadded:: 3.7
.. data:: METHOD_MD5
Another Modular Crypt Format method with 8 character salt and 22
- character hash.
+ character hash based on the MD5 hash function.
.. data:: METHOD_CRYPT
@@ -109,19 +116,25 @@ The :mod:`crypt` module defines the following functions:
Accept ``crypt.METHOD_*`` values in addition to strings for *salt*.
-.. function:: mksalt(method=None)
+.. function:: mksalt(method=None, *, log_rounds=12)
Return a randomly generated salt of the specified method. If no
*method* is given, the strongest method available as returned by
:func:`methods` is used.
- The return value is a string either of 2 characters in length for
- ``crypt.METHOD_CRYPT``, or 19 characters starting with ``$digit$`` and
- 16 random characters from the set ``[./a-zA-Z0-9]``, suitable for
- passing as the *salt* argument to :func:`crypt`.
+ 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.
.. versionadded:: 3.3
+ .. versionchanged:: 3.7
+ Added the *log_rounds* parameter.
+
+
Examples
--------
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 80f73b6..46121dc 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -229,6 +229,12 @@ contextlib
:func:`contextlib.asynccontextmanager` has been added. (Contributed by
Jelle Zijlstra in :issue:`29679`.)
+crypt
+-----
+
+Added support for the Blowfish method.
+(Contributed by Serhiy Storchaka in :issue:`31664`.)
+
dis
---