Skip to main content

Module hash

Module hash 

Source
Expand description

Poseidon2 hash over the Goldilocks field used by the Lighter signer.

Exposes the fixed-width permutation permute together with the sponge API the Lighter Schnorr binding consumes (hash_no_pad, hash_two_to_one, hash_n_to_one, hash_to_quintic_extension). Parameter constants live in params and were transcribed from the Apache-2.0 Go reference; equivalence is verified by fixture vectors under test_data/.

Re-exports§

pub use params::RATE;
pub use params::ROUNDS_F;
pub use params::ROUNDS_F_HALF;
pub use params::ROUNDS_P;
pub use params::WIDTH;

Modules§

params
Lighter Poseidon2 parameter set, defined verbatim from the Apache-2.0 Go reference implementation elliottech/poseidon_crypto at the pinned revision recorded in the fixture metadata. Each round constant, the diagonal of the internal MDS matrix, and the round counts must agree byte-for-byte with that reference; the fixture vectors under test_data/ verify equivalence.

Constants§

HASH_OUT
Output digest of the standard Poseidon2 hash, holding HASH_OUT field elements.

Functions§

hash_n_to_hash_no_pad
Compress an arbitrary-length input to a fixed HASH_OUT-element digest.
hash_n_to_m_no_pad
Variable-length absorb / variable-length squeeze sponge built on permute.
hash_n_to_one
Iteratively compress inputs left-to-right via hash_two_to_one.
hash_no_pad
Convenience alias for hash_n_to_hash_no_pad matching the Lighter Go API.
hash_to_quintic_extension
Hash an arbitrary-length input into the quintic extension Fp5.
hash_two_to_one
Two-to-one compression of two HASH_OUT-element digests.
hash_two_to_quintic
Hash a (Fp5, Fp5) pair as a 10-element preimage into a single Fp5.
permute
In-place Poseidon2 permutation over a WIDTH-element state.