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_stdcompatible — works on embedded and WASM targets- WASM ready — enable the
jsfeature for browser environments - Zeroize — private key material is automatically zeroized on drop
- Constant-time — verification uses constant-time comparison
- Optional serde — enable the
serdefeature for serialization - SIMD acceleration — AVX2 (x86_64) and NEON (AArch64) NTT behind
simd
§Feature Flags
| Feature | Default | Description |
|---|---|---|
std | ✅ | Enables getrandom for OS entropy (generate, sign, sign_prehash) |
serde | ❌ | Enables Serialize/Deserialize for key pairs, signatures, and modes |
simd | ❌ | Enables AVX2 (x86_64) and NEON (AArch64) NTT acceleration |
js | ❌ | Enables getrandom/js for WASM browser targets |
§Platform Support
| Target | Build | Notes |
|---|---|---|
| x86_64 Linux/macOS | ✅ | Full support, AVX2 SIMD optional |
| AArch64 (Apple Silicon, ARM) | ✅ | Full support, NEON SIMD optional |
wasm32-unknown-unknown | ✅ | Requires --no-default-features, add js for entropy |
thumbv7em-none-eabihf | ✅ | Requires --no-default-features, deterministic APIs only |
§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;