Function ivc::poseidon_8_56_5_3_2::interpreter::apply_permutation
source · pub fn apply_permutation<F, const STATE_SIZE: usize, const NB_FULL_ROUND: usize, const NB_PARTIAL_ROUND: usize, const NB_TOTAL_ROUND: usize, PARAMETERS, Env>(
env: &mut Env,
param: &PARAMETERS
) -> [Env::Variable; STATE_SIZE]where
F: PrimeField,
PARAMETERS: PoseidonParams<F, STATE_SIZE, NB_TOTAL_ROUND>,
Env: ColAccessCap<F, PoseidonColumn<STATE_SIZE, NB_FULL_ROUND, NB_PARTIAL_ROUND>> + HybridCopyCap<F, PoseidonColumn<STATE_SIZE, NB_FULL_ROUND, NB_PARTIAL_ROUND>>,
Expand description
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, then NB_PARTIAL_ROUND
partial rounds, and finally NB_FULL_ROUND/2
full rounds.
Each full rounds consists of the following steps:
- adding the round constants on the whole state
- applying the sbox on the whole state
- applying the linear layer on the whole state
Each partial round consists of the following steps:
- adding the round constants on the whole state
- applying the sbox on the first element of the state (FIXME: the specification mentions the last element - map the implementation provided in [mina_poseidon])
- applying the linear layer on the whole state