pub enum Algorithm {
MlKem(MlKem),
MlDsa(MlDsa),
SlhDsa(SlhDsa),
}Expand description
A unified enum representing any supported PQ algorithm.
This provides a single type that can represent any algorithm from any family, useful for generic processing.
§Example
use pq_oid::{Algorithm, MlKem, MlDsa};
use std::str::FromStr;
let alg = Algorithm::from_str("ML-KEM-512").unwrap();
assert_eq!(alg.oid(), "2.16.840.1.101.3.4.4.1");
// Convert from family-specific enums
let alg: Algorithm = MlDsa::Dsa65.into();
assert_eq!(alg.as_str(), "ML-DSA-65");Variants§
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub const SIGNATURE_COUNT: usize
pub const SIGNATURE_COUNT: usize
Number of signing algorithms.
Sourcepub const ALL_SIGNATURES: &'static [Algorithm]
pub const ALL_SIGNATURES: &'static [Algorithm]
All signing algorithms.
Sourcepub fn all() -> impl Iterator<Item = Algorithm>
pub fn all() -> impl Iterator<Item = Algorithm>
Returns an iterator over all supported algorithms.
Sourcepub fn signatures() -> impl Iterator<Item = Algorithm>
pub fn signatures() -> impl Iterator<Item = Algorithm>
Returns an iterator over all signing algorithms.
Sourcepub const fn algorithm_type(&self) -> AlgorithmType
pub const fn algorithm_type(&self) -> AlgorithmType
Returns the algorithm type.
Sourcepub const fn family(&self) -> AlgorithmFamily
pub const fn family(&self) -> AlgorithmFamily
Returns the algorithm family.
Sourcepub const fn security_level(&self) -> SecurityLevel
pub const fn security_level(&self) -> SecurityLevel
Returns the NIST security level.
Sourcepub const fn public_key_size(&self) -> usize
pub const fn public_key_size(&self) -> usize
Returns the public key size in bytes.
Sourcepub const fn private_key_size(&self) -> usize
pub const fn private_key_size(&self) -> usize
Returns the private key size in bytes.
Sourcepub const fn info(&self) -> AlgorithmInfo
pub const fn info(&self) -> AlgorithmInfo
Returns the complete algorithm info.
Sourcepub const fn as_slh_dsa(&self) -> Option<SlhDsa>
pub const fn as_slh_dsa(&self) -> Option<SlhDsa>
Returns this as an SlhDsa if it is one.
Trait Implementations§
impl Copy for Algorithm
impl Eq for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl Freeze for Algorithm
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnsafeUnpin for Algorithm
impl UnwindSafe for Algorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more