Skip to main content

Module ml_dsa

Module ml_dsa 

Source
Expand description

ML-DSA: Module-Lattice-Based Digital Signature Standard (FIPS 204).

This crate implements the ML-DSA (formerly CRYSTALS-Dilithium) digital signature scheme as specified in FIPS 204. ML-DSA is a post-quantum lattice-based signature scheme built on the hardness of the Module Learning With Errors (M-LWE) and Module Short Integer Solution (M-SIS) problems.

Three parameter sets are provided, corresponding to NIST security levels 2, 3, and 5:

  • MlDsa44Scheme – ML-DSA-44 (security level 2, ~128-bit classical security)
  • MlDsa65Scheme – ML-DSA-65 (security level 3, ~192-bit classical security)
  • MlDsa87Scheme – ML-DSA-87 (security level 5, ~256-bit classical security)

§Examples

use quantica::ml_dsa::{MlDsa44Scheme, OsRng, MlDsa};

let mut rng = OsRng;
let (pk, sk) = MlDsa44Scheme::keygen(&mut rng).unwrap();
let msg = b"Hello, post-quantum world!";
let sig = MlDsa44Scheme::sign(&sk, msg, b"", &mut rng).unwrap();
let valid = MlDsa44Scheme::verify(&pk, msg, b"", &sig).unwrap();
assert!(valid);

Re-exports§

pub use crate::prehash::PreHash;
pub use params::MlDsa44;
pub use params::MlDsa65;
pub use params::MlDsa87;
pub use params::Params;
pub use rng::CryptoRng;
pub use rng::OsRng;

Modules§

params
ML-DSA parameter sets and constants (FIPS 204, Table 1). ML-DSA parameter sets (FIPS 204, Table 1).
rng
Cryptographic random number generation trait and OS-backed implementation. Minimal cryptographic RNG trait and OS-backed implementation.

Structs§

MlDsa
Generic ML-DSA interface parameterized by security level.
Signature
ML-DSA signature. Type-tagged with the parameter set P.
SigningKey
ML-DSA signing key (the private half of a key pair).
VerifyingKey
ML-DSA verifying key (the public half of a key pair).

Enums§

MlDsaError
Error types for ML-DSA operations.

Type Aliases§

MlDsa44Scheme
Convenience alias for ML-DSA-44 (NIST security level 2).
MlDsa65Scheme
Convenience alias for ML-DSA-65 (NIST security level 3).
MlDsa87Scheme
Convenience alias for ML-DSA-87 (NIST security level 5).