MlDsa
MlDsa: ML-DSA-65 digital signatures (FIPS 204), the NIST post-quantum signature scheme.
Pure ML-DSA with an empty context string. Signing is hedged by default (sign mixes 32 fresh random bytes in, FIPS 204's default); sign_deterministic is the deterministic variant. Both verify the same way.
Backed by the vendored mldsa-native (runtime/pqc.c, runtime/third_party/), portable C, the same code on the compiled and interpreted backends.
Types
Functions
A fresh key pair from 32 random bytes.
let kp = MlDsa.keypair()
-- kp.public_key: 1952 bytes, kp.secret_key: 4032 bytesThe key pair a 32-byte seed determines (FIPS 204 ML-DSA.KeyGen_internal). Err for a seed of any other length.
Public key size in bytes: 1952.
Secret key size in bytes: 4032.
Sign [msg] with [secret_key] (hedged: 32 fresh random bytes are mixed in, so two signatures of one message differ). Err for a wrong-length key.
match MlDsa.sign(kp.secret_key, Bytes.from_string("hello")) do
Ok(s) -> MlDsa.verify(kp.public_key, Bytes.from_string("hello"), s) -- true
Err(e) -> ...
endSign [msg] with [secret_key] deterministically (FIPS 204's deterministic variant: the same key and message always give the same signature).
Signature size in bytes: 3309.