-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The digest function of the Crypto module's Hash object fails encoding hash in utf16le encoding #29793
Labels
crypto
Issues and PRs related to the crypto subsystem.
Comments
I would expect this test case to work
|
Thanks for opening an issue! The restriction had historical reasons but is unnecessary now. I’ll open a PR to remove it. |
addaleax
added a commit
to addaleax/node
that referenced
this issue
Oct 1, 2019
Since 71f633a, this is no longer necessary. Refs: nodejs#22622 Fixes: nodejs#29793
4 tasks
Yay thanks, soon we'll be able to accompanying our literally random values with almost as random characters. 😄 |
BridgeAR
pushed a commit
that referenced
this issue
Oct 9, 2019
Since 71f633a, this is no longer necessary. Refs: #22622 Fixes: #29793 PR-URL: #29795 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This was referenced Mar 11, 2021
This was referenced Apr 26, 2021
This was referenced Nov 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue
According to the documentation the
digest
function on a Hash object, theencoding
parameter should support theutf16le
anducs2
encodings.When creating a
sha256
hash usingcrypto
'screateHash
function, the resulting hash object can't be digested into these encodings.Instead an
Error [ERR_CRYPTO_HASH_DIGEST_NO_UTF16]
is thrown.How to reproduce using the interpreter
v6.17.1
utf16le
as encoding (same error occurs forucs2
which is an alias forutf16le
)v8.16.1
utf16le
as encoding (same error occurs forucs2
which is an alias forutf16le
)v10.16.3
utf16le
as encoding (same error occurs forucs2
which is an alias forutf16le
)v12.11.0
utf16le
as encoding (same error occurs forucs2
which is an alias forutf16le
)Expected output:
蚟臐䲈敽⾚ꃪ嫅ᗐ뾣ଫⲂ巑ᕬࠊ
Additional notes
Yup, it makes little to no sense encoding your hash using this encoding, but it's a documented feature after all. 🤷♂️
The text was updated successfully, but these errors were encountered: