Skip to main content

Module mldsa

Module mldsa 

Source
Expand description

ML-DSA-65 (FIPS-204 / Dilithium) runtime kernels — the post-quantum SIGNATURE scheme that complements ML-KEM-768 in the channel. This module builds bottom-up: the length-256 NTT over the Dilithium prime q = 8380417 (a COMPLETE transform, unlike Kyber’s incomplete one — q ≡ 1 (mod 512), so X²⁵⁶+1 splits fully), with signed Montgomery reduction. Validated against the schoolbook negacyclic convolution.

Constants§

PK_BYTES
pk = ρ ‖ pack(t1).
SIG_BYTES
ML-DSA-65 signature length.
SK_BYTES
sk = ρ ‖ K ‖ tr ‖ pack(s1) ‖ pack(s2) ‖ pack(t0).

Functions§

bench_verify_breakdown
Dev-only profiler: break verify’s cost into components to locate the hot spot. Not shipped logic.
keygen
ML-DSA.KeyGen_internal(ξ) → (pk, sk), deterministic in the 32-byte seed ξ.
mldsa_keypair_seq
mldsaKeypair(seed) → pk(1952) ‖ sk(4032).
mldsa_sign_seq
mldsaSign(sk, msg, ctx) → signature(3309).
mldsa_verify_seq
mldsaVerify(pk, msg, ctx, sig) → 1 if valid, else 0.
sign
Deterministic ML-DSA-65 signature over m with context ctx (the rnd = 0 variant).
verify
Verify an ML-DSA-65 signature; true iff valid for (pk, m, ctx).