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§
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 ^ expmod p via right-to-left binary square-and-multiply.- square
x * xshorthand — same cost asmul(x, x), kept separate for readability in the S-box.- sub
- Subtract a - b mod p. Result may be non-canonical.