[issue28384] hmac cannot be used with shake algorithms

2016-10-11 Thread Christian Heimes

Christian Heimes added the comment:

It's not a bug, but indented behavior. It does not make any sense to use SHAKE 
with the HMAC construct. In fact it does not make sense to combine Keccak 
sponge or Blake2 with HMAC at all. HMAC is only necessary for old, 
Merkle-Damgard hashing algorithms like MD5, SHA1 and SHA2, because they are 
subject to length extension attacks.

The correct solution is
4. improve documentation

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28384] hmac cannot be used with shake algorithms

2016-10-07 Thread SilentGhost

Changes by SilentGhost :


--
components: +Extension Modules
nosy: +christian.heimes
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28384] hmac cannot be used with shake algorithms

2016-10-07 Thread Thomas Kluyver

Changes by Thomas Kluyver :


--
nosy: +takluyver

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28384] hmac cannot be used with shake algorithms

2016-10-07 Thread Min RK

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com