ML-DSA
This crate implements all three ML-DSA (FIPS 204) variants 44, 65, and 87, and includes both a portable implementation and an optimized SIMD implementation for Intel AVX2-enabled platforms.
Verification
The portable and AVX2 code for field arithmetic, NTT polynomial arithmetic, and serialization is formally verified using hax and F*.
Usage
use ;
// Ensure you use good randomness.
// It is not recommended to use OsRng directly!
// Instead it is highly encouraged to use RNGs like NISTs DRBG to account for
// bad system entropy.
use *;
// This example uses ML-DSA-65. The other variants can be used the same way.
// Generate a key pair.
let randomness = random_array;
let key_pair = generate_key_pair;
// Generate a random message.
let message = ;
// Sign this random message
let randomness = random_array;
let signature = sign;
// Verify the signature and assert that it is indeed valid
assert!;