Skip to main content

Algorithm

Enum Algorithm 

Source
#[repr(u16)]
pub enum Algorithm {
Show 47 variants Classical = 80, PasswordClassical = 81, Hybrid = 256, PostQuantum = 512, MultiAlgorithm = 513, MlKem1024 = 514, MultiKem = 515, MultiKemTriple = 516, QuadLayer = 517, LatticeCodeHybrid = 518, Pq3Stack = 519, MaxSecureLightweight = 768, MaxSecurePurePq = 769, MaxSecureHybrid = 770, MaxSecureStateless = 771, MaxSecureCryptoAgile = 772, MaxSecurePqcZk = 773, MaxSecureHybridTransition = 774, FnDsa512Compact = 1_024, FnDsa1024Security = 1_025, FnDsaFpHardened = 1_026, FnDsaDualSignature = 1_027, FnDsaTransition = 1_028, FnDsaZk = 1_029, FnDsaZkStack = 1_030, FnDsaTransitionStack = 1_031, QuantumLatticeFusion = 1_280, PostZkHomomorphic = 1_281, QuantumResistantConsensus = 1_282, EntropyOrchestrated = 1_283, LatticeCodeHybridFn = 1_284, AiSynthesizedCryptoAgile = 1_285, Experimental = 1_286, Hqc128 = 1_536, Hqc192 = 1_537, Hqc256 = 1_538, MlKem512 = 1_792, MlKem768 = 1_793, MlDsa44 = 2_048, MlDsa65 = 2_049, MlDsa87 = 2_050, SlhDsaSha2_128s = 2_304, SlhDsaSha2_128f = 2_305, SlhDsaSha2_192s = 2_306, SlhDsaSha2_192f = 2_307, SlhDsaSha2_256s = 2_308, SlhDsaSha2_256f = 2_309,
}
Expand description

Supported cryptographic algorithms with unique identifiers

Each algorithm has a unique 16-bit identifier used in the binary format. Identifiers are grouped by algorithm family for easy categorization.

Variants§

§

Classical = 80

Classical cryptography: X25519 + Ed25519 + AES-256-GCM

§

PasswordClassical = 81

Password-based classical encryption

§

Hybrid = 256

Hybrid: ML-KEM-1024 + X25519 + ML-DSA-87 + Ed25519 + AES-256-GCM

§

PostQuantum = 512

Post-quantum: ML-KEM-1024 + ML-DSA-87 + AES-256-GCM

§

MultiAlgorithm = 513

Multi-algorithm runtime selection

§

MlKem1024 = 514

ML-KEM-1024 with AES-256-GCM

§

MultiKem = 515

Multi-KEM dual layer

§

MultiKemTriple = 516

Multi-KEM triple layer

§

QuadLayer = 517

Quad-layer redundant security

§

LatticeCodeHybrid = 518

Lattice-Code hybrid stack

§

Pq3Stack = 519

PQ3-Stack with forward secrecy

§

MaxSecureLightweight = 768

Max Secure: PQ Lightweight

§

MaxSecurePurePq = 769

Max Secure: Pure PQ

§

MaxSecureHybrid = 770

Max Secure: Hybrid Transition

§

MaxSecureStateless = 771

Max Secure: Stateless

§

MaxSecureCryptoAgile = 772

Max Secure: Crypto-Agile

§

MaxSecurePqcZk = 773

Max Secure: PQC + Zero-Knowledge

§

MaxSecureHybridTransition = 774

Max Secure: Hybrid Transition

§

FnDsa512Compact = 1_024

FN-DSA 512: Compact

§

FnDsa1024Security = 1_025

FN-DSA 1024: High-Security

§

FnDsaFpHardened = 1_026

FN-DSA: Floating-Point Hardened

§

FnDsaDualSignature = 1_027

FN-DSA: Dual Signature

§

FnDsaTransition = 1_028

FN-DSA: Transition Stack

§

FnDsaZk = 1_029

FN-DSA + Zero-Knowledge Stack

§

FnDsaZkStack = 1_030

FN-DSA + ZK Stack Enhanced

§

FnDsaTransitionStack = 1_031

FN-DSA: Transition Stack Enhanced

§

QuantumLatticeFusion = 1_280

Quantum-Inspired Lattice Fusion

§

PostZkHomomorphic = 1_281

Post-ZK Homomorphic with LFHE 2023

§

QuantumResistantConsensus = 1_282

Quantum-Resistant Consensus

§

EntropyOrchestrated = 1_283

Entropy-Orchestrated PQ Stack

§

LatticeCodeHybridFn = 1_284

Lattice-Code Hybrid FN

§

AiSynthesizedCryptoAgile = 1_285

AI-Synthesized Crypto-Agile

§

Experimental = 1_286

Experimental Engine (generic)

§

Hqc128 = 1_536

HQC-128 (NIST Level 1, 128-bit security)

§

Hqc192 = 1_537

HQC-192 (NIST Level 3, 192-bit security)

§

Hqc256 = 1_538

HQC-256 (NIST Level 5, 256-bit security)

§

MlKem512 = 1_792

ML-KEM-512 (NIST Level 1, 128-bit security)

§

MlKem768 = 1_793

ML-KEM-768 (NIST Level 3, 192-bit security)

§

MlDsa44 = 2_048

ML-DSA-44 (NIST Level 2, 128-bit security)

§

MlDsa65 = 2_049

ML-DSA-65 (NIST Level 3, 192-bit security)

§

MlDsa87 = 2_050

ML-DSA-87 (NIST Level 5, 256-bit security)

§

SlhDsaSha2_128s = 2_304

SLH-DSA-SHA2-128s (NIST Level 1, small signatures)

§

SlhDsaSha2_128f = 2_305

SLH-DSA-SHA2-128f (NIST Level 1, fast signatures)

§

SlhDsaSha2_192s = 2_306

SLH-DSA-SHA2-192s (NIST Level 3, small signatures)

§

SlhDsaSha2_192f = 2_307

SLH-DSA-SHA2-192f (NIST Level 3, fast signatures)

§

SlhDsaSha2_256s = 2_308

SLH-DSA-SHA2-256s (NIST Level 5, small signatures)

§

SlhDsaSha2_256f = 2_309

SLH-DSA-SHA2-256f (NIST Level 5, fast signatures)

Implementations§

Source§

impl Algorithm

Source

pub fn from_id(id: u16) -> Option<Self>

Convert u16 identifier to Algorithm enum

§Example
use pqc_binary_format::Algorithm;

let algo = Algorithm::from_id(0x0100).unwrap();
assert_eq!(algo, Algorithm::Hybrid);
Source

pub fn from_name(name: &str) -> Option<Self>

Resolve an algorithm from its name.

Accepts the canonical kebab-case names used by the PQCrypta API and web UI (e.g. "ml-kem-1024", "max-secure-pure-pq") as well as compact aliases with separators stripped (e.g. "mlkem1024"). Matching is case-insensitive.

§Example
use pqc_binary_format::Algorithm;

assert_eq!(Algorithm::from_name("ml-kem-1024"), Some(Algorithm::MlKem1024));
assert_eq!(Algorithm::from_name("Max-Secure-Pure-PQ"), Some(Algorithm::MaxSecurePurePq));
assert_eq!(Algorithm::from_name("nope"), None);
Source

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

Canonical kebab-case name matching the PQCrypta API / web UI identifier.

This is the stable machine name (e.g. "ml-kem-1024"), distinct from Algorithm::name which is the human-readable display label.

Source

pub const fn as_id(self) -> u16

Get u16 identifier for this algorithm

§Example
use pqc_binary_format::Algorithm;

assert_eq!(Algorithm::Hybrid.as_id(), 0x0100);
Source

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

Get human-readable name for this algorithm

§Example
use pqc_binary_format::Algorithm;

assert_eq!(Algorithm::Hybrid.name(), "Hybrid");
Source

pub const fn is_experimental(self) -> bool

Check if this algorithm is marked as experimental

Experimental algorithms may have reduced security guarantees and are intended for research purposes.

Source

pub fn all() -> Vec<Self>

Get all defined algorithm identifiers

Useful for iteration and testing.

Trait Implementations§

Source§

impl Clone for Algorithm

Source§

fn clone(&self) -> Algorithm

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Algorithm

Source§

impl Debug for Algorithm

Source§

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

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

impl<'de> Deserialize<'de> for Algorithm

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 Eq for Algorithm

Source§

impl Hash for Algorithm

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 Algorithm

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Algorithm

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 StructuralPartialEq for Algorithm

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Ungil for T
where T: Send,