Skip to content

hmac.digest() and HMAC(...).digest() disagree when blocksize is smaller than 16 #155428

Description

@picnixz

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

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions