Skip to content

Commit 67c4294

Browse files
committed
gh-129327: revise hashlib documentation to account for FIPS removing sha1
More generally, the current documentation is a bit scattered, talking about what terms are "equal" despite those terms not being very interesting and given the term "secure hash", probably wrong (because md5 and sha1 are not secure anymore). Let's talk about cryptographically secure instead, and note that two of them aren't. And then we can also link to the source for NIST going through the removal process for SHA1.
1 parent 7d27561 commit 67c4294

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Doc/library/hashlib.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@
2020

2121
--------------
2222

23-
This module implements a common interface to many different secure hash and
24-
message digest algorithms. Included are the FIPS secure hash algorithms SHA1,
25-
SHA224, SHA256, SHA384, SHA512, (defined in `the FIPS 180-4 standard`_),
26-
the SHA-3 series (defined in `the FIPS 202 standard`_) as well as RSA's MD5
27-
algorithm (defined in internet :rfc:`1321`). The terms "secure hash" and
28-
"message digest" are interchangeable. Older algorithms were called message
29-
digests. The modern term is secure hash.
23+
This module implements a common interface to many different hash algorithms.
24+
Included are the FIPS secure hash algorithms SHA224, SHA256, SHA384, SHA512,
25+
(defined in `the FIPS 180-4 standard`_), the SHA-3 series (defined in `the FIPS
26+
202 standard`_) as well as the non-cryptographically-secure algorithms SHA1
27+
(`formerly part of FIPS`_) and RSA's MD5 algorithm (defined in internet
28+
:rfc:`1321`).
3029

3130
.. note::
3231

@@ -812,6 +811,7 @@ Domain Dedication 1.0 Universal:
812811
.. _the FIPS 180-4 standard: https://csrc.nist.gov/pubs/fips/180-4/upd1/final
813812
.. _the FIPS 202 standard: https://csrc.nist.gov/pubs/fips/202/final
814813
.. _HACL\* project: https://github.com/hacl-star/hacl-star
814+
.. _formerly part of FIPS: https://csrc.nist.gov/news/2023/decision-to-revise-fips-180-4
815815

816816

817817
.. _hashlib-seealso:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Clarify that hashlib's SHA1 is no longer a FIPS secure algorithm. Clarify that
2+
hashlib has a mixture of cryptographically secure and non cryptographically
3+
secure hash algorithms. Patch by Eli Schwartz.

0 commit comments

Comments
 (0)