pub enum KemAlgorithm {
MlKem512,
MlKem768,
MlKem1024,
HybridX25519MlKem768,
XWing,
Hqc128,
Hqc192,
Hqc256,
Bike,
ClassicMceliece,
}Expand description
Identifies the KEM algorithm used.
Variants§
MlKem512
ML-KEM-512 (NIST FIPS 203, Security Level 1)
MlKem768
ML-KEM-768 (NIST FIPS 203, Security Level 3) — recommended default
MlKem1024
ML-KEM-1024 (NIST FIPS 203, Security Level 5)
HybridX25519MlKem768
Hybrid: X25519 + ML-KEM-768 — primary construction (profile v1,
HYBRID_PROFILE_V1; see docs/hybrid-profiles.md)
XWing
X-Wing: X25519 + ML-KEM-768, per draft-connolly-cfrg-xwing-kem
(profile v2, HYBRID_PROFILE_V2) — same component KEMs as
KemAlgorithm::HybridX25519MlKem768, different combiner and byte
layout (ML-KEM first). Recommended for new deployments; see
docs/hybrid-profiles.md. Added 0.3.0.
Hqc128
HQC-128 (NIST 2025, Security Level 1) — requires hqc feature
Hqc192
HQC-192 (NIST 2025, Security Level 3) — requires hqc feature
Hqc256
HQC-256 (NIST 2025, Security Level 5) — requires hqc feature
Bike
BIKE was never implemented; the bike feature/module were removed in 0.3.0. This variant is kept only for wire compatibility and will be removed in 0.4.0.
BIKE (NIST Round 4 alternate) — never implemented in this crate.
The bike feature and src/bike module (a permanent
compile_error! stub) were removed entirely in 0.3.0. This variant
is retained only so previously-serialized values (e.g.
"bike" in JSON) continue to deserialize without error; it carries
no working implementation in any release and never did. Scheduled
for removal in 0.4.0 per STABILITY.md §3’s one-minor-version
deprecation floor.
ClassicMceliece
Classic McEliece was never implemented; the mceliece feature/module were removed in 0.3.0. This variant is kept only for wire compatibility and will be removed in 0.4.0.
Classic McEliece (NIST Round 4 alternate) — never implemented in this crate.
The mceliece feature and src/mceliece module (a permanent
compile_error! stub) were removed entirely in 0.3.0. This variant
is retained only so previously-serialized values (e.g.
"classic_mceliece" in JSON) continue to deserialize without error;
it carries no working implementation in any release and never did.
Scheduled for removal in 0.4.0 per STABILITY.md §3’s
one-minor-version deprecation floor.
Implementations§
Source§impl KemAlgorithm
impl KemAlgorithm
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
Returns the algorithm identifier string (for DID Documents, JWK, etc.)
Sourcepub fn public_key_size(&self) -> usize
pub fn public_key_size(&self) -> usize
Returns the expected public key size in bytes (0 = variable).
Sourcepub fn ciphertext_size(&self) -> usize
pub fn ciphertext_size(&self) -> usize
Returns the expected ciphertext size in bytes (0 = variable).
HQC-128/256 sizes were corrected from 4481/14469 to 4433/14421 bytes
during the P2/alpha-001 HQC implementation pass — verified live
against both pqcrypto-hqc 0.2.2 and liboqs 0.13.0 (two
independent implementations of the same NIST submission, which
agree). HQC-192’s 8978-byte ciphertext was already correct. This
reflects the HQC round-4/2023 parameter revision to the
error-correcting code, which changed ciphertext size at the 128- and
256-bit levels but not the 192-bit level.
Returns the shared secret size in bytes (always 32 for all supported algorithms).