You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
XOF hash function changed their default outputLength to zero byte #58913
Linux ### 6.15.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 10 Jun 2025 21:32:33 +0000 x86_64 GNU/Linux
Subsystem
crypto
What steps will reproduce the bug?
Try to hash anything using a variable length hash function (e.g. shake128), without any options you get an empty buffer/string.
How often does it reproduce? Is there a required condition?
Reproducible, but I haven't dissected the exact version the default changed. I known it is somewhere between v14.21.3 and v22.14.0 and yes I realize this is a very large window 😕
What is the expected behavior? Why is that the expected behavior?
shake128 should default to outputLength = 16 as in earlier Node.JS versions. Other variable-length (XOF) hashes should also default to sensible non-zero length.
I believe it is sane to expect the following assertion:
It is not backward compatible, and unless I missed something this breaking change is not documented, which resulted in breaking our app when upgrading node
In general, defaulting to null length by default is very countrer-intuitive
The issue is not Node changing the default, it's OpenSSL.
While we are testing on later OpenSSL versions I am unsure about how "supported" they actually are meant to be. I've identified the issue and opened a PR to work around the OpenSSL breaking change.
But suspect this has to with using linked OpenSSL >= 3.4, @antoinep92 can you confirm?
Hi @panva indeed I confirm I have OpenSSL 3.5 installed. Thanks for tracking this down and the PR 👍
I haven't found any maximum supported version for OpenSSL either, but it makes sense that not all versions of all shared libs can be tested.
Activity
panva commentedon Jul 3, 2025
I'm not able to reproduce this issue with bundled OpenSSL
But suspect this has to with using linked OpenSSL >= 3.4, @antoinep92 can you confirm?
panva commentedon Jul 3, 2025
The issue is not Node changing the default, it's OpenSSL.
While we are testing on later OpenSSL versions I am unsure about how "supported" they actually are meant to be. I've identified the issue and opened a PR to work around the OpenSSL breaking change.
antoinep92 commentedon Jul 3, 2025
Hi @panva indeed I confirm I have OpenSSL 3.5 installed. Thanks for tracking this down and the PR 👍
I haven't found any maximum supported version for OpenSSL either, but it makes sense that not all versions of all shared libs can be tested.
crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4
crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4
crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4
panva commentedon Aug 1, 2025
Fixed in
crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4
crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4
crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4
crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4