4 ms·
Message, or key? (Hi guys something unrelated finally prompted me to unfreeze my HN account!)
by marshray 11y ago
Message, or key?
(Hi guys something unrelated finally prompted me to unfreeze my HN account!)
- dakami 11y agoYou're right. HMAC keys, from the internal hash perspective, are always one block long. So if the key coming into HMAC is less than blocksize, it's zero padded to blocksize. And if the key coming into HMAC is length greater than blocksize, it's hashed down to blocksize. Obviously this does create collisions if the key ends with nulls and is less than 64 bytes, or if the attacker can specify keys. None of this likely matters in practice.