Skip to main content

lib_q_types/
mldsa.rs

1//! ML-DSA (FIPS 204) object sizes (bytes) shared across the workspace.
2//!
3//! Single source of truth consumed by `lib-q-core` (`SecurityConstants`). The real
4//! implementation crate, `lib-q-ml-dsa`, computes its own sizes from private `const fn`
5//! formulas (`signing_key_size` / `verification_key_size` / `signature_size` in
6//! `src/constants.rs`) and carries a conformance test asserting equality against the
7//! constants here.
8//!
9//! `lib-q-types` must not depend on `lib-q-ml-dsa` (that would cycle back through
10//! `lib-q-core`, which `lib-q-ml-dsa` depends on), so the FIPS 204 sizes are listed here as
11//! plain literals rather than re-derived from the formula.
12
13/// ML-DSA-44 public (verification) key length.
14pub const MLDSA44_PUBLIC_KEY_BYTES: usize = 1312;
15/// ML-DSA-44 secret (signing) key length.
16pub const MLDSA44_SECRET_KEY_BYTES: usize = 2560;
17/// ML-DSA-44 signature length.
18pub const MLDSA44_SIGNATURE_BYTES: usize = 2420;
19
20/// ML-DSA-65 public (verification) key length.
21pub const MLDSA65_PUBLIC_KEY_BYTES: usize = 1952;
22/// ML-DSA-65 secret (signing) key length.
23pub const MLDSA65_SECRET_KEY_BYTES: usize = 4032;
24/// ML-DSA-65 signature length.
25pub const MLDSA65_SIGNATURE_BYTES: usize = 3309;
26
27/// ML-DSA-87 public (verification) key length.
28pub const MLDSA87_PUBLIC_KEY_BYTES: usize = 2592;
29/// ML-DSA-87 secret (signing) key length.
30pub const MLDSA87_SECRET_KEY_BYTES: usize = 4896;
31/// ML-DSA-87 signature length.
32pub const MLDSA87_SIGNATURE_BYTES: usize = 4627;