feat: add TurboSHAKE and KangarooTwelve digests#1032
Merged
Conversation
Adds the four WebCrypto Modern Algorithms digest functions defined in RFC 9861. OpenSSL 3.6 does not expose these via EVP, so the Keccak-p[1600, n_r=12] permutation, TurboSHAKE sponge, and KangarooTwelve tree-hashing are ported from Node's crypto_turboshake.cc (commit e0cab9dcf75) into a new HybridTurboShake Nitro module. subtle.digest() now accepts TurboSHAKE128/256 (with optional domainSeparation byte, default 0x1F) and KT128/256 (with optional customization BufferSource), with WebIDL-style validation matching Node's webidl.js. Tests cover the RFC 9861 §5 vectors plus the long-squeeze (10032 byte) cases that exercise the multi-rate-block output path and the multi-chunk tree-hashing branch.
Address /review feedback on the TurboSHAKE/KT branch: - Narrow nitro spec variants to named string-literal unions (TurboShakeVariant, KangarooTwelveVariant); nitrogen now emits enum class types and JSI converters, replacing string compares in HybridTurboShake with a single enum equality check. - Reject non-integer doubles for domainSeparation and outputLength defensively in the C++ layer (TS already validates). - Comment the pad buffer sizing rationale.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
🤖 End-to-End Test Results - AndroidStatus: ✅ Passed 📸 Final Test ScreenshotScreenshot automatically captured from End-to-End tests and will expire in 30 days This comment is automatically updated on each test run. |
Contributor
🤖 End-to-End Test Results - iOSStatus: ✅ Passed 📸 Final Test ScreenshotScreenshot automatically captured from End-to-End tests and will expire in 30 days This comment is automatically updated on each test run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Adds TurboSHAKE128/256 and KangarooTwelve KT128/KT256 WebCrypto digest support from RFC 9861.
Changes
subtle.digest()with TypeScript validation and generated Nitro bindings.Testing
Fixes #1008