Skip to content

feat: add TurboSHAKE and KangarooTwelve digests#1032

Merged
boorad merged 3 commits into
mainfrom
feat/turboshake-kt
May 6, 2026
Merged

feat: add TurboSHAKE and KangarooTwelve digests#1032
boorad merged 3 commits into
mainfrom
feat/turboshake-kt

Conversation

@boorad
Copy link
Copy Markdown
Collaborator

@boorad boorad commented May 6, 2026

Summary

Adds TurboSHAKE128/256 and KangarooTwelve KT128/KT256 WebCrypto digest support from RFC 9861.

Changes

  • Add a HybridTurboShake Nitro module for TurboSHAKE and KangarooTwelve digest execution.
  • Wire the new algorithms through subtle.digest() with TypeScript validation and generated Nitro bindings.
  • Add example app digest coverage for RFC vectors and long-output/tree-hashing cases.
  • Include required native build wiring and pod lock updates.

Testing

  • Not run during PR creation.
  • Added example app WebCrypto digest tests for the new algorithms.

Fixes #1008

boorad added 3 commits May 6, 2026 14:02
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.
@boorad boorad self-assigned this May 6, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-quick-crypto Ready Ready Preview, Comment May 6, 2026 6:28pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🤖 End-to-End Test Results - Android

Status: ✅ Passed
Platform: Android
Run: 25453572093

📸 Final Test Screenshot

Maestro Test Results - android

Screenshot automatically captured from End-to-End tests and will expire in 30 days


This comment is automatically updated on each test run.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🤖 End-to-End Test Results - iOS

Status: ✅ Passed
Platform: iOS
Run: 25453572166

📸 Final Test Screenshot

Maestro Test Results - ios

Screenshot automatically captured from End-to-End tests and will expire in 30 days


This comment is automatically updated on each test run.

@boorad boorad merged commit 8254643 into main May 6, 2026
10 checks passed
@boorad boorad deleted the feat/turboshake-kt branch May 6, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add TurboSHAKE128/256 and KangarooTwelve (KT128/KT256) WebCrypto digest algorithms

1 participant