Skip to main content

Crate dilithium

Crate dilithium 

Source
Expand description

Pure Rust implementation of ML-DSA (FIPS 204) / CRYSTALS-Dilithium.

A post-quantum digital signature scheme standardized as FIPS 204. Supports all three security levels: ML-DSA-44, ML-DSA-65, ML-DSA-87.

§Features

  • FIPS 204 compliant — supports pure ML-DSA and HashML-DSA (pre-hash)
  • no_std compatible — works on embedded and WASM targets
  • WASM ready — all dependencies support wasm32-unknown-unknown
  • Zeroize — private key material is automatically zeroized on drop
  • Constant-time — verification uses constant-time comparison
  • Optional serde — enable the serde feature for serialization

§Quick Start

use dilithium::{MlDsaKeyPair, ML_DSA_44};

let kp = MlDsaKeyPair::generate(ML_DSA_44).unwrap();
let sig = kp.sign(b"Hello, post-quantum world!", b"").unwrap();
assert!(MlDsaKeyPair::verify(
    kp.public_key(), &sig, b"Hello, post-quantum world!", b"",
    ML_DSA_44
));

Re-exports§

pub use params::DilithiumMode;
pub use params::ML_DSA_44;
pub use params::ML_DSA_65;
pub use params::ML_DSA_87;
pub use safe_api::DilithiumError;
pub use safe_api::DilithiumKeyPair;
pub use safe_api::DilithiumSignature;
pub use safe_api::MlDsaKeyPair;
pub use safe_api::MlDsaSignature;

Modules§

params
Dilithium parameter sets (FIPS 204 / ML-DSA).
safe_api
High-level safe Rust SDK for ML-DSA (FIPS 204) / CRYSTALS-Dilithium.