ml_dsa/module_lattice/mod.rs
1//! This module contains functions that should be common across ML-KEM and ML-DSA:
2//!
3//! * Linear algebra with degree-256 polynomials over a prime-order field, vectors of such
4//! polynomials, and NTT polynomials / vectors.
5//!
6//! * Packing of polynomials into coefficients with a specified number of bits.
7//!
8//! * Utility functions such as truncating integers, flattening arrays of arrays, and unflattening
9//! arrays into arrays of arrays.
10//!
11//! While this is currently a module within the `ml_dsa` crate, the idea of pulling it out is that
12//! it could be a separate crate on which both the `ml_dsa` crate and the `ml_kem` crate depend.
13
14// XXX(RLB) There are no unit tests in this module right now, because the algebra and encode/decode
15// routines all require a field, and the concrete field definitions are down in the dependent
16// modules. Maybe we should pull the field definitions up into this module so that we can verify
17// that everything works. That might also let us make private some of the tools used to build
18// things up.
19
20/// Linear algebra with degree-256 polynomials over a prime-order field, vectors of such
21/// polynomials, and NTT polynomials / vectors
22pub mod algebra;
23
24/// Packing of polynomials into coefficients with a specified number of bits.
25pub mod encode;
26
27/// Utility functions such as truncating integers, flattening arrays of arrays, and unflattening
28/// arrays into arrays of arrays.
29pub mod util;