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.

Author christian.heimes
Recipients christian.heimes, gregory.p.smith
Date 2019-09-12.10:44:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The hashlib module uses complicated macros and some pointless optimization. The code can be simplified to make maintenance easier. Cleanup also makes it easier to get rid of static global state and to add "usedforsecurity" feature.

* The EVPobject contains a PyObject* with the name of the hashing algorithm as PyUnicode object. The name is rarely used and can be efficiently calculated from a const char* of the EVP_MD_CTX.

* The module caches pre-generated EVP_MD_CTX objects for commonly used hashes like sha256. Tests with timeit has shown that generating a EVP_MD_CTX from a EVP constructor is as fast as copying and reinitializing a EVP_MD_CTX.

* The pre-calculated constructs can be replaced with argument clinic to make the code more readable.
Date User Action Args
2019-09-12 10:44:02christian.heimessetrecipients: + christian.heimes, gregory.p.smith
2019-09-12 10:44:02christian.heimessetmessageid: <>
2019-09-12 10:44:02christian.heimeslinkissue38132 messages
2019-09-12 10:44:02christian.heimescreate