The Parameters the Standards Actually Use
August 25, 20265 min readbeginner
The chapter has been built on q = 17 and n = 4. This note gives the real numbers, and explains the one place where ML-KEM cannot run the algorithm as described.
The chapter has been built on and . This note gives the real numbers, and explains the one place where ML-KEM cannot run the algorithm as described.
01.The two moduli
| ML-KEM (FIPS 203) | ML-DSA (FIPS 204) | |
|---|---|---|
| 256 | 256 | |
| 3329 | 8380417 | |
| in binary | 12 bits | 23 bits |
| factored | ||
| ? | no | yes |
| root used | , order 256 | , order 512 |
| transform | incomplete, 7 levels | complete, 8 levels |
Both use , which is the design decision from Module-LWE that lets one transform length serve every parameter set of both standards.
02.ML-DSA: the clean case
For ML-DSA everything works as this chapter described.
The modulus is , so
The transform needs to divide that, and there are thirteen factors of two available. It divides with room to spare.
FIPS 204 fixes , which has order exactly modulo . Eight levels of butterflies split a length- polynomial all the way down to individual values, pointwise multiplication is genuinely pointwise, and butterflies do the work.
The modulus was chosen for this. The form has two properties at once: it has enough factors of two in for the transform, and its sparse binary representation makes reduction modulo cheap, which Chapter 7 covers.
03.ML-KEM: the incomplete transform
For ML-KEM, and
Eight factors of two. The transform needs nine. As Roots of Unity in a Finite Field established, there is no primitive th root of unity in , so the complete negacyclic transform does not exist here.
A primitive th root does exist, and FIPS 203 uses . Two facts about it are worth checking:
The consequence is that the recursion stops one level early. Seven levels of butterflies instead of eight, splitting the length- polynomial into pieces rather than . Each piece is a polynomial of degree less than , meaning a pair of coefficients, rather than a single value.
So the "pointwise" step is not pointwise. Each of the positions holds a linear polynomial, and combining two of them means multiplying two linear polynomials modulo a quadratic. Concretely, at position the multiplication is
for a position-dependent constant , which works out to three or four coefficient multiplications rather than one.
That is the incomplete NTT. Every ML-KEM implementation carries it, and the cost is roughly a factor of two against a hypothetical complete transform.
04.Why accept that
The obvious question is why NIST did not pick a slightly different prime.
Because is small, and small has consequences everywhere.
A coefficient fits in bits. A product of two coefficients fits in , which is inside a single -bit register with room for accumulation. On a processor with -bit vector registers, sixteen coefficients are processed per instruction. On a -bit microcontroller the arithmetic still fits without multi-word tricks. In hardware, a multiplier is a small block, and a -bit memory is a small memory.
A prime one bit larger, chosen for a friendlier factorisation, would push coefficients to bits and products to . That is worse in the vector register, worse in the multiplier array, and worse in every memory in the design, on every single operation. The clean transform would have been paid for continuously, everywhere, to save a factor of two in one place.
The committee took the small prime. It is a good illustration of the trade this whole book keeps circling: mathematical convenience losing to implementation cost, deliberately.
05.The twiddle table
One practical detail that matters for both schemes.
The butterflies need powers of , and computing them on demand would mean an exponentiation per butterfly, which would undo the entire saving. Instead the powers are precomputed into a table of constants, stored in bit-reversed order as The Butterfly and Bit Reversal described, and simply looked up.
For ML-KEM that is twiddles at bits each, about bytes. For ML-DSA it is twiddles at bits, under a kilobyte. Both are small enough to sit in a ROM in hardware or a constant array in software, and both standards publish the exact tables so that independent implementations agree bit for bit.
That last point is not a formality. The transform is deterministic, so two correct implementations must produce identical intermediate values, and the published tables are what makes cross-implementation test vectors possible.