Skip to content

Clinic signatures of HACL* hash functions are inconsistent with OpenSSL implementation #134696

Description

@8R0WNI3

Bug description:

According to its docstring, the function hashlib.shake_128(...).hexdigest() should accept an argument length, either as positional or as keyword argument. However, since Python 3.14, the function only accepts positional arguments and fails with TypeError: shake_128.hexdigest() takes no keyword arguments otherwise.

I narrowed the root cause for this behaviour down to the following two commits (I'm not 100% sure though as I don't have any C-background):

Reproducer:

import hashlib
hashlib.shake_128(b'').hexdigest(1) # working
hashlib.shake_128(b'').hexdigest(length=1) # not working anymore, but was working before

For example, on Python Python 3.13.3 (main, Apr 8 2025, 13:54:08) [Clang 17.0.0 (clang-1700.0.13.3)] on my mac I can still use the keyword argument, but on alpine:edge Python 3.12.10 (main, May 21 2025, 16:23:36) [GCC 14.2.0] on linux it is expecting positional arguments only.

CPython versions tested on:

CPython main branch, 3.14, 3.13, 3.12

Operating systems tested on:

Linux, macOS

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions