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
crypto(matryoshka): wasm32+simd128 backend — same ndarray::simd::U32x16 source, browser lane
Completes the matryoshka's browser half. The fork's `ndarray_simd` backend cfg
gates widen from x86_64+avx512f to
`any(all(x86_64, avx512f), all(wasm32, simd128))` (backends.rs module decl +
lib.rs::process_with_backend dispatch), and the target-scoped ndarray dep to
`cfg(any(target_arch="x86_64", target_arch="wasm32"))`.
The SAME src/backends/ndarray_simd.rs source now drives BOTH hardware lanes —
the AVX-512 `__m512i` lane on a server build and the native `[U32x4; 4]` lane on
a wasm32+simd128 browser build — because the backend only ever uses `U32x16`
ops, and ndarray's polyfill lowers `U32x16` to the right lane per target. aarch64
and other fork builds still never pull ndarray (they use RustCrypto's backends).
Verified:
- `cargo build --manifest-path vendor/chacha20/Cargo.toml --target
wasm32-unknown-unknown --lib` with `-Ctarget-feature=+simd128` compiles
ndarray-for-wasm (std, minimal features) + the wasm backend clean;
- x86 avx512 RustCrypto vectors still 9/9 green through ndarray_simd after the
cfg widening.
Bit-exact by composition: the ndarray_simd source is RFC-8439-proven on x86, and
the wasm U32x16 [U32x4;4] lane is node-proven by the existing wasm_simd CI job.
CI: added a compile-guard step to the wasm_simd job (build the fork for
wasm32+simd128) so a future ndarray::simd change that broke the wasm backend
fails there.
A consumer building `encryption` as a wasm cdylib with +simd128 now gets the
accelerated XChaCha20-Poly1305 keystream transparently — the browser goal.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K6pT32kk6pnuAAqR3JiYqu
0 commit comments