KemAlgorithm

Enum KemAlgorithm 

Source
#[repr(i32)]
pub enum KemAlgorithm { MlKem512 = 0, MlKem768 = 1, MlKem1024 = 2, }
Expand description

Key Encapsulation Mechanism algorithms.

Variants§

§

MlKem512 = 0

ML-KEM-512 (128-bit security)

§

MlKem768 = 1

ML-KEM-768 (192-bit security)

§

MlKem1024 = 2

ML-KEM-1024 (256-bit security)

Implementations§

Source§

impl KemAlgorithm

Source

pub const KYBER_512: Self = Self::MlKem512

Alias for ML-KEM-512 (NIST naming)

Source

pub const KYBER_768: Self = Self::MlKem768

Alias for ML-KEM-768 (NIST naming)

Source

pub const KYBER_1024: Self = Self::MlKem1024

Alias for ML-KEM-1024 (NIST naming)

Source

pub const fn public_key_size(self) -> usize

Get public key size in bytes.

Source

pub const fn secret_key_size(self) -> usize

Get secret key size in bytes.

Source

pub const fn ciphertext_size(self) -> usize

Get ciphertext size in bytes.

Source

pub const fn shared_secret_size(self) -> usize

Get shared secret size in bytes (always 32).

Source

pub const fn to_raw(self) -> i32

Get raw value for FFI.

Source

pub fn from_raw(value: i32) -> Option<Self>

Create from raw FFI value.

Trait Implementations§

Source§

impl Clone for KemAlgorithm

Source§

fn clone(&self) -> KemAlgorithm

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for KemAlgorithm

Source§

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

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

impl Display for KemAlgorithm

Source§

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

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

impl Hash for KemAlgorithm

Source§

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

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

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 KemAlgorithm

Source§

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

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

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 Copy for KemAlgorithm

Source§

impl Eq for KemAlgorithm

Source§

impl StructuralPartialEq for KemAlgorithm

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.