Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(39017)

Side by Side Diff: Doc/library/hashlib.rst

Issue 16113: Add SHA-3 (Keccak) support
Patch Set: Created 7 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Doc/license.rst » ('j') | Modules/hashlib.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`hashlib` --- Secure hashes and message digests 1 :mod:`hashlib` --- Secure hashes and message digests
2 ==================================================== 2 ====================================================
3 3
4 .. module:: hashlib 4 .. module:: hashlib
5 :synopsis: Secure hash and message digest algorithms. 5 :synopsis: Secure hash and message digest algorithms.
6 .. moduleauthor:: Gregory P. Smith <greg@krypto.org> 6 .. moduleauthor:: Gregory P. Smith <greg@krypto.org>
7 .. sectionauthor:: Gregory P. Smith <greg@krypto.org> 7 .. sectionauthor:: Gregory P. Smith <greg@krypto.org>
8 8
9 9
10 .. index:: 10 .. index::
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 strings of more than 2047 bytes at object creation or on update. 44 strings of more than 2047 bytes at object creation or on update.
45 45
46 .. note:: 46 .. note::
47 47
48 Feeding string objects is to :meth:`update` is not supported, as hashes work 48 Feeding string objects is to :meth:`update` is not supported, as hashes work
49 on bytes, not on characters. 49 on bytes, not on characters.
50 50
51 .. index:: single: OpenSSL; (use in module hashlib) 51 .. index:: single: OpenSSL; (use in module hashlib)
52 52
53 Constructors for hash algorithms that are always present in this module are 53 Constructors for hash algorithms that are always present in this module are
54 :func:`md5`, :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, and 54 :func:`md5`, :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`,
55 :func:`sha512`. Additional algorithms may also be available depending upon the 55 :func:`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, and
56 OpenSSL library that Python uses on your platform. 56 :func:`sha3_512`. Additional algorithms may also be available depending upon
57 the OpenSSL library that Python uses on your platform.
58
59 .. versionchanged:: 3.4
60 Add sha3 family of hash algorithms.
57 61
58 For example, to obtain the digest of the byte string ``b'Nobody inspects the 62 For example, to obtain the digest of the byte string ``b'Nobody inspects the
59 spammish repetition'``:: 63 spammish repetition'``::
60 64
61 >>> import hashlib 65 >>> import hashlib
62 >>> m = hashlib.md5() 66 >>> m = hashlib.md5()
63 >>> m.update(b"Nobody inspects") 67 >>> m.update(b"Nobody inspects")
64 >>> m.update(b" the spammish repetition") 68 >>> m.update(b" the spammish repetition")
65 >>> m.digest() 69 >>> m.digest()
66 b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' 70 b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 Module :mod:`base64` 168 Module :mod:`base64`
165 Another way to encode binary hashes for non-binary environments. 169 Another way to encode binary hashes for non-binary environments.
166 170
167 http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf 171 http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
168 The FIPS 180-2 publication on Secure Hash Algorithms. 172 The FIPS 180-2 publication on Secure Hash Algorithms.
169 173
170 http://en.wikipedia.org/wiki/Cryptographic_hash_function#Cryptographic_hash_a lgorithms 174 http://en.wikipedia.org/wiki/Cryptographic_hash_function#Cryptographic_hash_a lgorithms
171 Wikipedia article with information on which algorithms have known issues a nd 175 Wikipedia article with information on which algorithms have known issues a nd
172 what that means regarding their use. 176 what that means regarding their use.
173 177
OLDNEW
« no previous file with comments | « no previous file | Doc/license.rst » ('j') | Modules/hashlib.h » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+