pub fn ntt_shuffled(
f: &mut [i16; 256],
rng: &mut impl CryptoRng,
) -> Result<(), MlKemError>Expand description
Forward NTT with randomized butterfly ordering (SPA countermeasure).
Functionally equivalent to super::ntt::ntt but randomizes the
execution order of butterfly operations at each NTT level. Both the
group order (which butterfly group runs first) and the intra-group
order (which pair within a group runs first) are independently
shuffled using fresh generate_permutation calls.
A new random permutation is generated for every level and every group, so successive invocations produce different power traces even for identical inputs.
§Arguments
f- A mutable reference to a 256-coefficient polynomial. Modified in place.rng- A cryptographic RNG for generating shuffle permutations.
§Errors
Returns MlKemError::RngFailure if the RNG fails during permutation generation.