Skip to main content

SlhDsa

Enum SlhDsa 

Source
pub enum SlhDsa {
    Sha2_128s,
    Sha2_128f,
    Sha2_192s,
    Sha2_192f,
    Sha2_256s,
    Sha2_256f,
    Shake128s,
    Shake128f,
    Shake192s,
    Shake192f,
    Shake256s,
    Shake256f,
}
Expand description

SLH-DSA (Stateless Hash-Based Digital Signature Algorithm) variants.

§Example

use pq_oid::SlhDsa;
use std::str::FromStr;

let alg = SlhDsa::from_str("SLH-DSA-SHA2-128s").unwrap();
assert_eq!(alg.oid(), "2.16.840.1.101.3.4.3.20");
assert_eq!(alg.hash_function(), pq_oid::HashFunction::Sha2);

Variants§

§

Sha2_128s

§

Sha2_128f

§

Sha2_192s

§

Sha2_192f

§

Sha2_256s

§

Sha2_256f

§

Shake128s

§

Shake128f

§

Shake192s

§

Shake192f

§

Shake256s

§

Shake256f

Implementations§

Source§

impl SlhDsa

Source

pub const COUNT: usize = 12

Number of SLH-DSA variants.

Source

pub const ALL: &'static [SlhDsa]

All SLH-DSA variants.

Source

pub const fn as_str(&self) -> &'static str

Returns the algorithm name string.

Source

pub const fn oid(&self) -> &'static str

Returns the OID in dotted notation.

Source

pub const fn hash_function(&self) -> HashFunction

Returns the hash function used.

Source

pub const fn mode(&self) -> SlhDsaMode

Returns the mode (small or fast).

Source

pub const fn security_level(&self) -> SecurityLevel

Returns the NIST security level.

Source

pub const fn public_key_size(&self) -> usize

Returns the public key size in bytes.

Source

pub const fn private_key_size(&self) -> usize

Returns the private key size in bytes.

Source

pub const fn signature_size(&self) -> usize

Returns the signature size in bytes.

Source

pub const fn info(&self) -> AlgorithmInfo

Returns the complete algorithm info.

Source

pub fn from_oid(oid: &str) -> Result<Self>

Parse from an OID string.

Trait Implementations§

Source§

impl AsRef<str> for SlhDsa

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for SlhDsa

Source§

fn clone(&self) -> SlhDsa

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 SlhDsa

Source§

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

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

impl Display for SlhDsa

Source§

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

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

impl From<SlhDsa> for Algorithm

Source§

fn from(a: SlhDsa) -> Self

Converts to this type from the input type.
Source§

impl FromStr for SlhDsa

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for SlhDsa

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 SlhDsa

Source§

fn eq(&self, other: &SlhDsa) -> 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<&str> for SlhDsa

Source§

type Error = Error

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

fn try_from(s: &str) -> Result<Self>

Performs the conversion.
Source§

impl Copy for SlhDsa

Source§

impl Eq for SlhDsa

Source§

impl StructuralPartialEq for SlhDsa

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.