MLDSA

Enum MLDSA 

Source
#[repr(u32)]
pub enum MLDSA { MLDSA44 = 2, MLDSA65 = 3, MLDSA87 = 5, }
Expand description

Security levels for the ML-DSA post-quantum digital signature algorithm.

ML-DSA (Module Lattice-based Digital Signature Algorithm) is a post-quantum digital signature algorithm standardized by NIST. It provides resistance against attacks from both classical and quantum computers.

Each security level offers different trade-offs between security, performance, and key/signature sizes:

  • MLDSA44: NIST security level 2 (roughly equivalent to AES-128)
  • MLDSA65: NIST security level 3 (roughly equivalent to AES-192)
  • MLDSA87: NIST security level 5 (roughly equivalent to AES-256)

The numeric values (2, 3, 5) correspond to the NIST security levels and are used in CBOR serialization.

Variants§

§

MLDSA44 = 2

ML-DSA Level 2 (NIST security level 2, roughly equivalent to AES-128)

§

MLDSA65 = 3

ML-DSA Level 3 (NIST security level 3, roughly equivalent to AES-192)

§

MLDSA87 = 5

ML-DSA Level 5 (NIST security level 5, roughly equivalent to AES-256)

Implementations§

Source§

impl MLDSA

Source

pub fn keypair(self) -> (MLDSAPrivateKey, MLDSAPublicKey)

Generates a new ML-DSA keypair with the specified security level.

§Returns

A tuple containing the private key and public key.

§Examples
use bc_components::MLDSA;

let (private_key, public_key) = MLDSA::MLDSA44.keypair();
Source

pub fn private_key_size(&self) -> usize

Returns the size of a private key in bytes for this security level.

Source

pub fn public_key_size(&self) -> usize

Returns the size of a public key in bytes for this security level.

Source

pub fn signature_size(&self) -> usize

Returns the size of a signature in bytes for this security level.

Trait Implementations§

Source§

impl Clone for MLDSA

Source§

fn clone(&self) -> MLDSA

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 MLDSA

Source§

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

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

impl From<MLDSA> for CBOR

Converts an MLDSA value to CBOR.

Source§

fn from(level: MLDSA) -> Self

Converts to the numeric security level value (2, 3, or 5).

Source§

impl Hash for MLDSA

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MLDSA

Source§

fn eq(&self, other: &MLDSA) -> 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 TryFrom<CBOR> for MLDSA

Attempts to convert CBOR to an MLDSA value.

Source§

fn try_from(cbor: CBOR) -> Result<Self>

Converts from a CBOR-encoded security level (2, 3, or 5).

§Errors

Returns an error if the CBOR value doesn’t represent a valid ML-DSA level.

Source§

type Error = Error

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

impl Copy for MLDSA

Source§

impl Eq for MLDSA

Source§

impl StructuralPartialEq for MLDSA

Auto Trait Implementations§

§

impl Freeze for MLDSA

§

impl RefUnwindSafe for MLDSA

§

impl Send for MLDSA

§

impl Sync for MLDSA

§

impl Unpin for MLDSA

§

impl UnwindSafe for MLDSA

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> CBOREncodable for T
where T: Into<CBOR> + Clone,

Source§

fn to_cbor(&self) -> CBOR

Converts this value to a CBOR object. Read more
Source§

fn to_cbor_data(&self) -> Vec<u8>

Converts this value directly to binary CBOR data. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,