Bug report
Bug description:
hmac.digest() and HMAC(...).digest() return DIFFERENT MACs for any digest whose block_size is below 16, because hmac._compute_digest_fallback reads block_size raw while hmac.HMAC._init_old clamps it to 64.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Bug report
Bug description:
hmac.digest()andHMAC(...).digest()return DIFFERENT MACs for any digest whoseblock_sizeis below 16, becausehmac._compute_digest_fallbackreadsblock_sizeraw whilehmac.HMAC._init_oldclamps it to 64.CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
hmac.digestandhmac.HMAC.digestoutputs when using small block sizes #155429