p3_poseidon2

Function mds_light_permutation

Source
pub fn mds_light_permutation<AF: AbstractField, MdsPerm4: MdsPermutation<AF, 4>, const WIDTH: usize>(
    state: &mut [AF; WIDTH],
    mdsmat: &MdsPerm4,
)
Expand description

Implement the matrix multiplication used by the external layer.

Given a 4x4 MDS matrix M, we multiply by the 4N x 4N matrix [[2M M ... M], [M 2M ... M], ..., [M M ... 2M]].