Solana SHAKE256
A no_std, zero-dependency, SVM-optimized SHAKE256 / Keccak-f[1600] (FIPS 202) library.
Features
- no_std, zero dependencies: works in embedded, WebAssembly, and on-chain Solana programs without the standard library or any transitive crates.
- Bertoni lane-complementing: the 6-lane Keccak-Team set
{1,2,8,12,17,20}, complemented once per permute, fused with an in-place chi-row + 10 cell-saves layout (noB[25]scratch) — ~456 NOTs eliminated across the 24 rounds. - Zero crate-boundary cost: every method is
#[inline]; with the consumers'opt-level=3SBF build there is no codegen penalty versus an in-tree module. - Both output styles: the bulk rate-draining path
(
rate_lanes()+permute(), for Falcon'shash_to_pointrejection sampling) and a const-lengthsqueeze::<LEN>()(for HAWK'shpub/M/h).
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
The lifecycle is new → absorb* → finalize → (squeeze | rate_lanes/permute).
Fixed-length output
use Shake256;
let mut s = new;
s.absorb;
s.finalize;
let mut out = ;
s.squeeze;
Draining the rate (bulk path)
use Shake256;
let mut s = new;
s.absorb;
s.finalize;
loop
Status
Not audited. Cross-checked against the NIST SHAKE256 KATs ("", "abc",
multi-block) and, transitively, the full PQCsignKAT suites of the two consumer
crates.
Disclaimer
Use this library at your own risk.
License
Licensed under the MIT License. The license includes the standard "as-is" warranty disclaimer — use at your own risk.