GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `hmac.digest()` and `HMAC(...).digest()` disagree when blocksize is smaller than 16 · Issue #155428 · python/cpython

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

New issue
Copy link
New issue
Copy link
Closed
Closed
hmac.digest() and HMAC(...).digest() disagree when blocksize is smaller than 16#155428
Copy link
Assignees
picnixz
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@picnixz
picnixz
opened on Aug 9, 2026
Issue body actions

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

  • gh-155428: align hmac.digest and hmac.HMAC.digest outputs when using small block sizes #155429
  • [3.15] gh-155428: align hmac.digest and hmac.HMAC.digest outputs when using small block sizes (GH-155429) #160060
  • [3.14] gh-155428: align hmac.digest and hmac.HMAC.digest outputs when using small block sizes (GH-155429) #160061
Reacted by Gregory P. Smith

Activity

  1. picnixz
    self-assigned this
    on Aug 9, 2026
  2. picnixz
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Aug 9, 2026
  3. picnixz
    added a parent issue on Aug 9, 2026
    • Meta-issue for bugs in Lib/hmac.py and Lib/hashlib.py #155413
  4. picnixz
    added 3 commits that reference this issue on Oct 21, 2026

    gh-155428: align `hmac.digest` and `hmac.HMAC.digest` outputs when us…

    815dc47

    [3.14] gh-155428: align `hmac.digest` and `hmac.HMAC.digest` outputs …

    1a80008

    [3.15] gh-155428: align `hmac.digest` and `hmac.HMAC.digest` outputs …

    eb930ba
  5. picnixz
    closed this as completedon Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @picnixz
    picnixz

Labels

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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.