diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2010-09-06 08:30:23 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2010-09-06 08:30:23 (GMT) |
commit | 13b55291ac84d2fb74f93c286a0bd5673f439e38 (patch) | |
tree | 3be269bb34eb782e9ec28a92b3f07d1b95b32c4f /Doc/library/hashlib.rst | |
parent | c86adb4c5c616e6aa7dcf9e59c71ba66ab5ea553 (diff) | |
download | cpython-13b55291ac84d2fb74f93c286a0bd5673f439e38.zip cpython-13b55291ac84d2fb74f93c286a0bd5673f439e38.tar.gz cpython-13b55291ac84d2fb74f93c286a0bd5673f439e38.tar.bz2 |
hashlib has two new constant attributes: algorithms_guaranteed and
algorithms_avaiable that respectively list the names of hash algorithms
guaranteed to exist in all Python implementations and the names of hash
algorithms available in the current process.
Renames the attribute new in 3.2a0 'algorithms' to 'algorithms_guaranteed'.
Diffstat (limited to 'Doc/library/hashlib.rst')
-rw-r--r-- | Doc/library/hashlib.rst | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index 6fa01be..fa95821 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -70,10 +70,13 @@ More condensed: >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest() 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' -A generic :func:`new` constructor that takes the string name of the desired -algorithm as its first parameter also exists to allow access to the above listed -hashes as well as any other algorithms that your OpenSSL library may offer. The -named constructors are much faster than :func:`new` and should be preferred. +.. function:: new(name[, data]) + + Is a generic constructor that takes the string name of the desired + algorithm as its first parameter. It also exists to allow access to the + above listed hashes as well as any other algorithms that your OpenSSL + library may offer. The named constructors are much faster than :func:`new` + and should be preferred. Using :func:`new` with an algorithm provided by OpenSSL: @@ -82,12 +85,22 @@ Using :func:`new` with an algorithm provided by OpenSSL: >>> h.hexdigest() 'cc4a5ce1b3df48aec5d22d1f16b894a0b894eccc' -This module provides the following constant attribute: +Hashlib provides the following constant attributes: + +.. data:: algorithms_guaranteed + + Contains the names of the hash algorithms guaranteed to be supported + by this module on all platforms. + + .. versionadded:: 3.2 -.. data:: hashlib.algorithms +.. data:: algorithms_available - A tuple providing the names of the hash algorithms guaranteed to be - supported by this module. + Contains the names of the hash algorithms that are available + in the running Python interpreter. These names will be recognized + when passed to :func:`new`. :attr:`algorithms_guaranteed` + will always be a subset. Duplicate algorithms with different + name formats may appear in this set (thanks to OpenSSL). .. versionadded:: 3.2 |