New submission from Min RK:

HMAC digest methods call inner.digest() with no arguments, but new-in-3.6 shake 
algorithms require a length argument.

possible solutions:

1. add optional length argument to HMAC.[hex]digest, and pass through to inner 
hash object
2. set hmac.digest_size, and use that to pass through to inner hash object if 
inner hash object has digest_size == 0
3. give shake hashers a default value for `length` in digest methods (logically 
32 for shake_256, 16 for shake_128, I think)

test:

import hmac, hashlib

h = hmac.HMAC(b'secret', digestmod=hashlib.shake_256)
h.hexdigest() # raises on self.inner.digest() requires length argument

----------
messages: 278235
nosy: minrk
priority: normal
severity: normal
status: open
title: hmac cannot be used with shake algorithms
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28384>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to