nx_sha3_512_wasm.nx
buildroot/runtime/nx_sha3_512_wasm.nx
about
nx_sha3_512_wasm.nx -- SHA-3-512 (FIPS 202) self-contained for WAT target.
Same Keccak-f[1600] sponge as SHA-3-256 with a different rate/capacity:
* Rate r = 576 bits = 72 bytes (SHA-3-512: capacity c = 1024 bits)
* Domain separator = 0x06 (same as SHA-3 family)
* Output: first 64 bytes of state
Used by ML-KEM-768 keygen to split the 32-byte seed d into the
(rho, sigma) pair via G(d || k) = SHA-3-512(d || k).
Inlined Keccak-f[1600]: 24 rounds of theta, rho, pi, chi, iota.
Each lane is 64-bit; we pack i64 in/out at byte level (LE) to keep
the WAT codegen path narrow (no i64 loads through u8 pointers).
API:
nx_sha3_256_one_shot(msg_ptr, msg_len, state_ptr, out_ptr) -> i64
msg_ptr -- input bytes
msg_len -- input length
state_ptr -- >= 256 bytes scratch (200 for state + 56 slack)
out_ptr -- 32 bytes for digest
Verified against FIPS 202 / NIST CAVP test vectors (empty + "abc" +
"The quick brown fox..." per common reference set).
license_tier: INDEPENDENT_REDERIVE
genealogy_id: international-research-sources/nist/fips_202
lineage_id: nishi_sha3_512_wasm_q1
dependencies 0 imports · 0 importers
imports: none
imported by: nobody (leaf or entry point)
structs
| none |
consts
| none |
functions
| 31 | func _lane_load(p: *u8) -> i64 called by 1: _keccak_f1600 |
| 50 | func _lane_store(p: *u8, v: i64) -> i64 called by 1: _keccak_f1600 |
| 65 | func _rotl64(x: i64, n: i64) -> i64 called by 1: _keccak_f1600 |
| 74 | func _keccak_rc(i: i64) -> i64 called by 1: _keccak_f1600 |
| 103 | func _rho_off(lane_idx: i64) -> i64 called by 1: _keccak_f1600 |
| 136 | func _keccak_f1600(state_ptr: *u8) -> i64 |
| 217 | func nx_sha3_512_one_shot(msg_ptr: *u8, msg_len: i64, calls 1: _keccak_f1600 |