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 2020-05-16.15:01:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589641291.33.0.635001105595.issue40645@roundup.psfhosted.org>
In-reply-to
Content
Python's hmac module provides a pure Python based implementation on top of the hashlib module. OpenSSL offers a dedicated HMAC implementation that has a couple of benefits over pure Python implementation:

- OpenSSL HMAC is slightly faster and requires slightly less memory and allocations.
- Python's HMAC only works for RFC 2104 HMACs with digests like MD5, SHA1, SHA2, and SHA3. Other digests types like Blake2 use a completely different style of HMAC. OpenSSL's HMAC API works for all sorts of digests. OpenSSL 3.0.0 also supports Blake2 MAC with its standard API.
- OpenSSL HMAC is standard and compliance conform. Certain compliance restrictions require that MAC and keyed hashing is implemented in a certain way. Our HMAC code is considered a custom implementation of a crypto primitive and in violation of compliance rules.

For 3.9 I plan to deprecate hmac.HMAC.digest_con, hmac.HMAC.inner, and hmac.HMAC.outer attributes. They are implementation specific details any way. I'm also going to provide a _hashlib.hmac_new() function so we can test the new code.

For 3.10 I'll be switching over to _haslib.hmac_new() when the digestmod is a string or a callable that returns _hashlib.HASH code.
History
Date User Action Args
2020-05-16 15:01:31christian.heimessetrecipients: + christian.heimes, gregory.p.smith
2020-05-16 15:01:31christian.heimessetmessageid: <1589641291.33.0.635001105595.issue40645@roundup.psfhosted.org>
2020-05-16 15:01:31christian.heimeslinkissue40645 messages
2020-05-16 15:01:30christian.heimescreate