pub fn external_initial_permute_state<R: PrimeCharacteristicRing, CT: Copy, MdsPerm4: MdsPermutation<R, 4>, const WIDTH: usize>(
state: &mut [R; WIDTH],
initial_external_constants: &[[CT; WIDTH]],
add_rc_and_sbox: fn(&mut R, CT),
mat4: &MdsPerm4,
)Expand description
Applies the initial external rounds of the Poseidon2 permutation.
Apply the external linear layer and run a sequence of standard external rounds consisting of
- Adding round constants to each element of the state.
- Apply the S-box to each element of the state.
- Applying an external linear layer (based on a
4x4MDS matrix).
ยงParameters
state: The state array at the start of the permutation.initial_external_constants: Per-round constants which are added to each state element.add_rc_and_sbox: A function that adds the round constant and applies the S-box to a given element.mat4: The 4x4 MDS matrix used in the external linear layer.