Skip to main content

Crate bench_goldilocks_poseidon2

Crate bench_goldilocks_poseidon2 

Source
Expand description

Shared no_std Goldilocks + Poseidon2-WIDTH8 implementation used across the mini-verifier / goldilocks-mul / poseidon2-perm STARK benches. See per-module docs for algorithm details.

Constants§

ONE
P
WIDTH
ZERO

Functions§

add
Add a + b mod p. Result may be non-canonical (in [0, 2^64)).
canonical
Canonicalize: return the unique representative in [0, p).
double
2 * x via add(x, x) — keeps the implementation in pure field ops rather than relying on the storage representation.
inv
Field inverse via Fermat’s little theorem: x^(p-2) mod p.
mul
Multiply a * b mod p. Result may be non-canonical.
permute
Full Poseidon2-Goldilocks-WIDTH8 permutation in place.
pow
base ^ exp mod p via right-to-left binary square-and-multiply.
square
x * x shorthand — same cost as mul(x, x), kept separate for readability in the S-box.
sub
Subtract a - b mod p. Result may be non-canonical.