Skip to main content

Params

Trait Params 

Source
pub trait Params: 'static {
    const K: usize;
    const ETA1: usize;
    const ETA2: usize;
    const DU: usize;
    const DV: usize;
    const EK_LEN: usize = _;
    const DK_LEN: usize = _;
    const CT_LEN: usize = _;
    const SS_LEN: usize = 32;
}
Expand description

Parameter set trait for ML-KEM security levels.

Implemented by MlKem512, MlKem768, and MlKem1024, each providing the constants that define key sizes, ciphertext sizes, and sampling parameters for a specific NIST security category.

The derived constants (EK_LEN, DK_LEN, CT_LEN, SS_LEN) are computed automatically from the core parameters.

Required Associated Constants§

Source

const K: usize

Module rank (number of polynomials per vector). Determines security level.

Source

const ETA1: usize

CBD sampling parameter for secret key and first error vector.

Source

const ETA2: usize

CBD sampling parameter for second error vectors during encryption.

Source

const DU: usize

Compression bit-width for the u component of ciphertexts.

Source

const DV: usize

Compression bit-width for the v component of ciphertexts.

Provided Associated Constants§

Source

const EK_LEN: usize = _

Encapsulation key size in bytes: 384*k + 32.

Source

const DK_LEN: usize = _

Decapsulation key size in bytes: 768*k + 96.

Layout: dk_pke || ek_pke || H(ek) || z where z is the implicit rejection seed.

Source

const CT_LEN: usize = _

Ciphertext size in bytes: 32*(du*k + dv).

Source

const SS_LEN: usize = 32

Shared secret size in bytes. Always 32 (256 bits) for all parameter sets.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Params for MlKem512

Source§

const K: usize = 2

Source§

const ETA1: usize = 3

Source§

const ETA2: usize = 2

Source§

const DU: usize = 10

Source§

const DV: usize = 4

Source§

impl Params for MlKem768

Source§

const K: usize = 3

Source§

const ETA1: usize = 2

Source§

const ETA2: usize = 2

Source§

const DU: usize = 10

Source§

const DV: usize = 4

Source§

impl Params for MlKem1024

Source§

const K: usize = 4

Source§

const ETA1: usize = 2

Source§

const ETA2: usize = 2

Source§

const DU: usize = 11

Source§

const DV: usize = 5