[issue40645] Use OpenSSL's HMAC API
Christian Heimes
report at bugs.python.org
Sun May 17 04:46:02 EDT 2020
Christian Heimes <lists at cheimes.de> added the comment:
def new(key, msg=None, digestmod=''):
# use fast HMAC if OpenSSL bindings are available and digestmod is
# either a string or a callable that returns an OpenSSL HASH object.
if _hashopenssl is not None:
if isinstance(digestmod, str):
return _hashopenssl.hmac_new(key, msg, digestmod)
if callable(digestmod):
digest = digestmod(b'')
if isinstance(digest, _hashopenssl.HASH):
return _hashopenssl.hmac_new(key, msg, digest.name)
return HMAC(key, msg, digestmod)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40645>
_______________________________________
More information about the Python-bugs-list
mailing list