Description
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
- gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures #134713
- gh-134696: fix
hashlib
FIPS-only BLAKE-2 buildbot #134968 - [3.14] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) #134961
- [3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) #134962