Index Mathematics Conjectures nbv lettuce Widgets

poseidon_milli_state!

Apply the milli Poseidon permutation to a state, reusing cached constraints. Cryptography

poseidon_milli_state! output_len, input_len, state

Applies the Poseidon permutation of the milli field to a state of input_len + output_len elements. It produces the same constraints and witness as calling the standard library function poseidon_milli_state_{input_len}_{output_len} directly (e.g. poseidon_milli_state_32_16), but the constraints are built once per (output_len, input_len) and cached for the rest of the process, then remapped onto new witness indices. This makes repeated permutations, as in a sponge, much faster to compile.

Arguments

output_len
Static scalar. Note the order: the function name lists input_len first, the precompile takes output_len first.
input_len
Static scalar. A function poseidon_milli_state_{input_len}_{output_len} must exist in the standard library; currently only 32, 16 (poseidon_milli_state! 16, 32, state) does.
state
Vector of input_len + output_len elements. Static or linear-combination entries are first materialized into witness variables.

Returns

The permuted state, a witness vector of the same length. It is an expression-form precompile.

Constraints

Exactly those of the stdlib permutation function, plus one row per state entry that had to be materialized. Inside static_eval! it simply calls the stdlib function statically.

Example

let state = calloc(48)
let out = poseidon_milli_state! 16, 32, state
static n = len! out
n

Notes

Milli field only: the permutation functions live in the milli namespace and the cache stores coefficients as 32-bit integers. Used by the transcript sponge in oraccle_squeeze.

Used in the standard library

milli/lattice/lattice_permutation, oraccle/oraccle_squeeze