p3_mds/lib.rs
1//! Maximum distance separable (MDS) matrix multiplication.
2//!
3//! MDS matrices provide optimal diffusion for algebraic hash functions.
4//! Any k x k submatrix is invertible, so the associated linear code
5//! achieves the Singleton bound.
6//!
7//! Three strategies are provided:
8//! - Reed-Solomon coset evaluation via Bowers butterfly networks.
9//! - An optimized variant that integrates coset shifts into twiddle factors.
10//! - Karatsuba-style convolution for circulant matrices.
11
12#![no_std]
13
14extern crate alloc;
15
16use p3_symmetric::Permutation;
17
18mod butterflies;
19pub mod coset_mds;
20pub mod integrated_coset_mds;
21pub mod karatsuba_convolution;
22pub mod util;
23
24/// Marker trait for permutations that are MDS.
25///
26/// An MDS permutation guarantees that any square submatrix of the
27/// underlying linear map is invertible.
28pub trait MdsPermutation<T: Clone, const WIDTH: usize>: Permutation<[T; WIDTH]> {}