lib-q-hash
Post-quantum hash functions for lib-Q.
Features
- SHA-3: SHA3-224, SHA3-256, SHA3-384, SHA3-512
- SHAKE: SHAKE128, SHAKE256
- cSHAKE: Customizable SHAKE functions
- TurboSHAKE: Accelerated SHAKE variant
- KangarooTwelve: Fast hash function based on Keccak
- KMAC: Keyed Message Authentication Code (128/256)
- TupleHash: Tuple-based hashing (128/256)
- ParallelHash: Parallel processing for large data (128/256)
WebAssembly
The parallelhash feature enables Rayon and must not be used on wasm32-unknown-unknown; the crate fails to compile with that feature on WASM. Use serial builds for browser targets.
Usage
Basic Hashing
use ;
let mut hasher = new;
hasher.update;
let result = hasher.finalize;
KMAC
use ;
let mut kmac = new;
kmac.update;
let mut output = ;
kmac.finalize;
TupleHash
use ;
let mut tuplehash = new;
let tuple = vec!;
tuplehash.update_tuple;
let mut output = ;
tuplehash.finalize;
ParallelHash
use ;
let mut parallelhash = new;
parallelhash.update;
let mut output = ;
parallelhash.finalize;
State Serialization
use ;
let mut kmac = new;
kmac.update;
let serialized = kmac.serialize;
let mut kmac2 = deserialize.unwrap;
kmac2.update;
Features
default- Enables alloc and OID supportalloc- Heap allocation for dynamic output sizesoid- Object Identifier support for ASN.1zeroize- Secure memory wipingparallelhash- Rayon-based parallel processingasm- ARMv8 assembly optimizations
Workspace
lib-q-sha3, lib-q-keccak, and lib-q-k12 supply the Keccak/SHA-3 family implementations this crate integrates (see also lib-q-keccak-digest). ML-DSA and lattice crates consume the same XOF stack via those dependencies. Index: repository README.
License
Apache-2.0