Skip to main content

textbook_partial_permute_state

Function textbook_partial_permute_state 

Source
pub fn textbook_partial_permute_state<F: Field, A: Algebra<F> + InjectiveMonomial<D>, Mds: Permutation<[A; WIDTH]>, const WIDTH: usize, const D: u64>(
    state: &mut [A; WIDTH],
    constants: &PartialRoundConstants<F, WIDTH>,
    mds: &Mds,
)
Expand description

Textbook partial round permutation with forward-substituted scalar constants.

Instead of the sparse matrix decomposition, this applies the full MDS permutation per round but with only a scalar constant addition to state[0]. After all rounds, a residual vector is added to the state.

This is beneficial when the MDS permutation is very fast (e.g., Karatsuba convolution for power-of-2 circulant matrices), making the per-round MDS cost competitive with the sparse approach.