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

Delta Between Two Patch Sets: Doc/library/hashlib.rst

Issue 26798: add BLAKE2 to hashlib
Left Patch Set: Created 3 years, 1 month ago
Right Patch Set: Created 3 years, 1 month 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Doc/library/hashlib-blake2.rst ('k') | Lib/hashlib.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 6
7 .. moduleauthor:: Gregory P. Smith <greg@krypto.org> 7 .. moduleauthor:: Gregory P. Smith <greg@krypto.org>
8 .. sectionauthor:: Gregory P. Smith <greg@krypto.org> 8 .. sectionauthor:: Gregory P. Smith <greg@krypto.org>
9 9
10 **Source code:** :source:`Lib/hashlib.py` 10 **Source code:** :source:`Lib/hashlib.py`
11 11
12 .. index:: 12 .. index::
13 single: message digest, MD5 13 single: message digest, MD5
14 single: secure hash algorithm, SHA1, SHA224, SHA256, SHA384, SHA512 14 single: secure hash algorithm, SHA1, SHA224, SHA256, SHA384, SHA512
15 single: blake2b, blake2s
Martin Panter 2016/09/04 15:58:52 Wouldn’t it be better to move these to the other f
16 15
17 .. testsetup:: 16 .. testsetup::
18 17
19 import hashlib 18 import hashlib
20 19
21 20
22 -------------- 21 --------------
23 22
24 This module implements a common interface to many different secure hash and 23 This module implements a common interface to many different secure hash and
25 message digest algorithms. Included are the FIPS secure hash algorithms SHA1, 24 message digest algorithms. Included are the FIPS secure hash algorithms SHA1,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 58
60 .. note:: 59 .. note::
61 60
62 Feeding string objects into :meth:`update` is not supported, as hashes work 61 Feeding string objects into :meth:`update` is not supported, as hashes work
63 on bytes, not on characters. 62 on bytes, not on characters.
64 63
65 .. index:: single: OpenSSL; (use in module hashlib) 64 .. index:: single: OpenSSL; (use in module hashlib)
66 65
67 Constructors for hash algorithms that are always present in this module are 66 Constructors for hash algorithms that are always present in this module are
68 :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, 67 :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`,
69 and :func:`sha512`. :func:`md5` is normally available as well, though it 68 :func:`sha512`, :func:`blake2b`, and :func:`blake2s`.
69 :func:`md5` is normally available as well, though it
70 may be missing if you are using a rare "FIPS compliant" build of Python. 70 may be missing if you are using a rare "FIPS compliant" build of Python.
71 Additional algorithms may also be available depending upon the OpenSSL 71 Additional algorithms may also be available depending upon the OpenSSL
72 library that Python uses on your platform. 72 library that Python uses on your platform.
73
74 .. versionadded:: 3.6
75 :func:`blake2b` and :func:`blake2s` were added.
73 76
74 For example, to obtain the digest of the byte string ``b'Nobody inspects the 77 For example, to obtain the digest of the byte string ``b'Nobody inspects the
75 spammish repetition'``:: 78 spammish repetition'``::
76 79
77 >>> import hashlib 80 >>> import hashlib
78 >>> m = hashlib.sha256() 81 >>> m = hashlib.sha256()
79 >>> m.update(b"Nobody inspects") 82 >>> m.update(b"Nobody inspects")
80 >>> m.update(b" the spammish repetition") 83 >>> m.update(b" the spammish repetition")
81 >>> m.digest() 84 >>> m.digest()
82 b'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf \x0c\x95\x0fK\x94\x06' 85 b'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf \x0c\x95\x0fK\x94\x06'
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 247
245 http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf 248 http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
246 The FIPS 180-2 publication on Secure Hash Algorithms. 249 The FIPS 180-2 publication on Secure Hash Algorithms.
247 250
248 https://en.wikipedia.org/wiki/Cryptographic_hash_function#Cryptographic_hash_ algorithms 251 https://en.wikipedia.org/wiki/Cryptographic_hash_function#Cryptographic_hash_ algorithms
249 Wikipedia article with information on which algorithms have known issues a nd 252 Wikipedia article with information on which algorithms have known issues a nd
250 what that means regarding their use. 253 what that means regarding their use.
251 254
252 https://www.ietf.org/rfc/rfc2898.txt 255 https://www.ietf.org/rfc/rfc2898.txt
253 PKCS #5: Password-Based Cryptography Specification Version 2.0 256 PKCS #5: Password-Based Cryptography Specification Version 2.0
LEFTRIGHT

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