Skip to main content

DilithiumMode

Enum DilithiumMode 

Source
pub enum DilithiumMode {
    Dilithium2,
    Dilithium3,
    Dilithium5,
}
Expand description

ML-DSA / Dilithium security levels (FIPS 204).

The FIPS 204 standard names are ML-DSA-44, ML-DSA-65, and ML-DSA-87. The Dilithium2/3/5 names are provided for compatibility with the original CRYSTALS-Dilithium submission.

Variants§

§

Dilithium2

ML-DSA-44 (NIST Level 2): K=4, L=4

§

Dilithium3

ML-DSA-65 (NIST Level 3): K=6, L=5

§

Dilithium5

ML-DSA-87 (NIST Level 5): K=8, L=7

Implementations§

Source§

impl DilithiumMode

Source

pub const fn mode_tag(self) -> u8

Byte tag for binary serialization (matches NIST level: 2, 3, 5).

Source

pub const fn from_tag(tag: u8) -> Option<Self>

Recover mode from a serialization tag.

Source

pub const fn k(self) -> usize

Number of rows in the matrix A.

Source

pub const fn l(self) -> usize

Number of columns in the matrix A.

Source

pub const fn eta(self) -> i32

Secret key coefficient bound.

Source

pub const fn tau(self) -> usize

Number of ±1 coefficients in the challenge polynomial.

Source

pub const fn beta(self) -> i32

Rejection bound: TAU * ETA.

Source

pub const fn gamma1(self) -> i32

Masking vector coefficient range: coefficients in [-(GAMMA1-1), GAMMA1].

Source

pub const fn gamma2(self) -> i32

Low-order rounding range: GAMMA2 = (Q-1)/88 or (Q-1)/32.

Source

pub const fn omega(self) -> usize

Maximum number of ones in the hint vector.

Source

pub const fn ctildebytes(self) -> usize

Challenge hash output length in bytes.

Source

pub const fn polyz_packedbytes(self) -> usize

Packed size for z polynomial.

Source

pub const fn polyw1_packedbytes(self) -> usize

Packed size for w1 polynomial.

Source

pub const fn polyeta_packedbytes(self) -> usize

Packed size for eta polynomial.

Source

pub const fn public_key_bytes(self) -> usize

Public key size in bytes.

Source

pub const fn secret_key_bytes(self) -> usize

Secret key size in bytes.

Source

pub const fn signature_bytes(self) -> usize

Signature size in bytes.

Source

pub fn hash_oid(self) -> &'static [u8]

Get the HashML-DSA OID for this mode.

Source

pub fn fips_name(self) -> &'static str

FIPS 204 algorithm name.

Trait Implementations§

Source§

impl Clone for DilithiumMode

Source§

fn clone(&self) -> DilithiumMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DilithiumMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DilithiumMode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for DilithiumMode

Source§

fn eq(&self, other: &DilithiumMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DilithiumMode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for DilithiumMode

Source§

impl Eq for DilithiumMode

Source§

impl StructuralPartialEq for DilithiumMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,