Module ivc::poseidon_8_56_5_3_2::interpreter
source · Expand description
Implement an interpreter for a specific instance of the Poseidon inner permutation.
The Poseidon construction is defined in the paper “Poseidon: A New Hash
Function”.
The Poseidon instance works on a state of size STATE_SIZE
and is designed
to work with full and partial rounds. As a reminder, the Poseidon
permutation is a mapping from F^STATE_SIZE
to F^STATE_SIZE
.
The user is responsible to provide the correct number of full and partial
rounds for the given field and the state.
Also, it is hard-coded that the substitution is 5
. The user must verify
that 5
is coprime with p - 1
where p
is the order the field.
The constants and matrix can be generated the file
poseidon/src/pasta/params.sage
Traits
- Represents the parameters of the instance of the Poseidon permutation. Constants are the round constants for each round, and MDS is the matrix used by the linear layer. The type is parametrized by the field, the state size, and the total number of rounds.
Functions
- Apply the HADES-based Poseidon to the state. The environment has to be initialized with the input values. It mimicks the version described in the paper “Poseidon: A New Hash Function”, figure 2. The construction first starts with
NB_FULL_ROUND/2
full rounds, thenNB_PARTIAL_ROUND
partial rounds, and finallyNB_FULL_ROUND/2
full rounds. - Populates and checks one poseidon invocation.