This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Edit docs to hide hashlib.md5()
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: berker.peksag, christian.heimes, dholth, docs@python, eric.araujo, gregory.p.smith, pitrou, python-dev, underrun
Priority: normal Keywords: easy, patch

Created on 2012-07-27 15:46 by dholth, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue15468.patch underrun, 2012-07-30 23:45 tweak treatment of md5 in hashlib docs review
hashlib.patch dholth, 2012-08-01 15:48 review
Messages (11)
msg166577 - (view) Author: Daniel Holth (dholth) * Date: 2012-07-27 15:46
md5() has been obsolete since 1996. It has no place as the first item in hashlib's list of "guaranteed to be available" hashes, and it doesn't work when Python has been compiled to be FIPS-compliant.

The documentation should be edited to make md5's availability as non-obvious as possible.
msg166586 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012-07-27 17:19
The only edit that is needed is for md5 to be documented as unavailable when Python has been compiled in FIPS-compliant mode.  Most of the world does not and will never use that mode.

md5 is still a perfectly good algorithm for many uses and is required for legacy reasons to support the decades of already deployed uses of md5.
msg166593 - (view) Author: Daniel Holth (dholth) * Date: 2012-07-27 18:11
Not to mention its continued popularity as a password hash, surpassed only by double-rot13. You've convinced me, it is reasonable to continue to support, nay, recommend md5 for the non-FIPS world. This hash function continues to have raving fans, especially in applications such as hashing data that is either read from or written to disk where the computational and storage cost of using a more modern hash is too severe for the majority of new applications.
msg166596 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-27 18:39
The hashlib doc starts with "Warning: Some algorithms have known hash collision weaknesses, see the FAQ at the end" (the "FAQ at the end" is a link to a Wikipedia article). The sentence "Included are the FIPS secure hash algorithms SHA1, SHA224, SHA256, SHA384, and SHA512 (defined in FIPS 180-2) as well as RSA’s MD5 algorithm" also conveys the idea that MD5 is not part of the "secure" bunch. The only addition I can think of would be to replace md5 with sha1 in the small example snippet at the beginning.
msg166918 - (view) Author: Daniel Holth (dholth) * Date: 2012-07-30 18:33
Taking a second look it is pretty good.

The only other thing that might be worth mentioning explicitly is that the "always present" hashes don't actually use OpenSSL.

"Constructors for hash algorithms that are always present in this module are md5(), sha1(), sha224(), sha256(), sha384(), and sha512(). Additional algorithms may also be available depending upon the OpenSSL library that Python uses on your platform."
msg166920 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012-07-30 20:26
The always present hashes do use openssl if the openssl version hashlib was compiled against supports them.  otherwise it falls back to the builtin C implementations.
msg166934 - (view) Author: Derek Wilson (underrun) Date: 2012-07-30 23:45
Attached patch mentioning availability of md5 under FIPS compliance and the use of OpenSSL algorithms when available and altering the initial example to use sha1 instead of md5.
msg167141 - (view) Author: Daniel Holth (dholth) * Date: 2012-08-01 15:48
re-tweak treatment of md5 in hashlib docs (the SHA-2 family is currently recommended by http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html)
msg268153 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-10 20:21
The looks good to me in general, but I'd suggest to refer to the new algorithms_guaranteed and algorithms_available attributes in the following paragraph:

    +:func:`sha512`. The :func:`md5` is typically available, but will be missing if
    +Python has been compiled in FIPS-compliant mode. If hashlib was compiled with
    +OpenSSL support then additional algorithms may also be available depending
    +upon the OpenSSL library that Python uses on your platform. OpenSSL
    +implementations of the builtin algorithms are used if available.
msg268304 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-12 00:56
New changeset 13ea0a1d7dde by Gregory P. Smith in branch 'default':
issue15468 - use sha256 instead of md5 or sha1 in the examples.
https://hg.python.org/cpython/rev/13ea0a1d7dde
msg268305 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-12 01:02
New changeset 1cfd627bee05 by Gregory P. Smith in branch 'default':
Clarify that md5 is in the algorithms_guaranteed list despite what
https://hg.python.org/cpython/rev/1cfd627bee05
History
Date User Action Args
2022-04-11 14:57:33adminsetgithub: 59673
2016-06-12 01:03:13gregory.p.smithsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-06-12 01:02:23python-devsetmessages: + msg268305
2016-06-12 00:56:56python-devsetnosy: + python-dev
messages: + msg268304
2016-06-10 20:21:53berker.peksagsetassignee: docs@python
type: enhancement
components: + Documentation
versions: + Python 3.5, Python 3.6, - Python 3.3
nosy: + docs@python, berker.peksag

messages: + msg268153
stage: patch review
2012-08-01 20:51:01christian.heimessetnosy: + christian.heimes
2012-08-01 15:48:29dholthsetfiles: + hashlib.patch

messages: + msg167141
2012-07-30 23:45:39underrunsetfiles: + issue15468.patch

nosy: + underrun
messages: + msg166934

keywords: + patch
2012-07-30 20:26:15gregory.p.smithsetmessages: + msg166920
2012-07-30 18:33:31dholthsetmessages: + msg166918
2012-07-27 18:39:35pitrousetnosy: + pitrou
messages: + msg166596
2012-07-27 18:11:31dholthsetmessages: + msg166593
2012-07-27 17:19:58gregory.p.smithsetkeywords: + easy

messages: + msg166586
2012-07-27 17:05:21eric.araujosetnosy: + gregory.p.smith, eric.araujo
2012-07-27 15:46:47dholthcreate