#[non_exhaustive]pub struct MlKem512;Expand description
ML-KEM-512 parameter set marker. NIST security category 1 (≈ AES-128).
Module rank k = 2. Public key 800 B, secret key 1632 B,
ciphertext 768 B, shared secret 32 B.
KemCore is implemented unconditionally. Works in any build —
no --features kyber512 needed. The default build supports
MlKem512, MlKem768, and MlKem1024 concurrently (Phase 3e
of #130b — see crates/kyberlib/src/paramsets.rs).
Implementations§
Source§impl MlKem512
impl MlKem512
Sourcepub const PUBLIC_KEY_BYTES: usize = 800
pub const PUBLIC_KEY_BYTES: usize = 800
Public encapsulation key length in bytes.
Sourcepub const SECRET_KEY_BYTES: usize = 1632
pub const SECRET_KEY_BYTES: usize = 1632
Private decapsulation key length in bytes.
Sourcepub const CIPHERTEXT_BYTES: usize = 768
pub const CIPHERTEXT_BYTES: usize = 768
Ciphertext length in bytes.
Sourcepub const SHARED_SECRET_BYTES: usize = 32
pub const SHARED_SECRET_BYTES: usize = 32
Shared-secret length in bytes.
Sourcepub const ALGORITHM_ID: &'static str = "ML-KEM-512"
pub const ALGORITHM_ID: &'static str = "ML-KEM-512"
Stable algorithm identifier per the IETF LAMPS draft.
Trait Implementations§
impl Copy for MlKem512
impl Eq for MlKem512
Source§impl KemCore for MlKem512
impl KemCore for MlKem512
Source§const ALGORITHM_ID: &'static str = "ML-KEM-512"
const ALGORITHM_ID: &'static str = "ML-KEM-512"
Stable algorithm identifier per the IETF LAMPS draft —
"ML-KEM-512", "ML-KEM-768", or "ML-KEM-1024".Source§const OID: &'static str = "2.16.840.1.101.3.4.4.1"
const OID: &'static str = "2.16.840.1.101.3.4.4.1"
Dotted-decimal object identifier per
2.16.840.1.101.3.4.4.{1,2,3}.Source§type EncapsulationKey = MlKem512EncapKey
type EncapsulationKey = MlKem512EncapKey
Encapsulation key (public side).
Source§type DecapsulationKey = MlKem512DecapKey
type DecapsulationKey = MlKem512DecapKey
Decapsulation key (secret side). Zeroized on drop.
Source§type Ciphertext = MlKem512Ciphertext
type Ciphertext = MlKem512Ciphertext
Ciphertext.
Source§fn generate<R: RngCore + CryptoRng>(
rng: &mut R,
) -> Result<(Self::DecapsulationKey, Self::EncapsulationKey), KyberLibError>
fn generate<R: RngCore + CryptoRng>( rng: &mut R, ) -> Result<(Self::DecapsulationKey, Self::EncapsulationKey), KyberLibError>
Generate a fresh decapsulation / encapsulation key pair. Read more
Source§fn generate_from_seed(
d: &[u8; 32],
z: &[u8; 32],
) -> Result<(Self::DecapsulationKey, Self::EncapsulationKey), KyberLibError>
fn generate_from_seed( d: &[u8; 32], z: &[u8; 32], ) -> Result<(Self::DecapsulationKey, Self::EncapsulationKey), KyberLibError>
Derive a key pair from the seed
(d, z): FIPS 203 Algorithm 16,
ML-KEM.KeyGen_internal(d, z). Read moreSource§impl MlKemParams for MlKem512
impl MlKemParams for MlKem512
Source§const ETA1: usize = 3
const ETA1: usize = 3
Centred-binomial width η₁ for the secret-key sampling.
3 for ML-KEM-512, 2 for ML-KEM-768 and ML-KEM-1024.
Source§const DU: usize = 10
const DU: usize = 10
Ciphertext compression bit-width for the u half. 10 for
ML-KEM-512/768, 11 for ML-KEM-1024.
Source§const DV: usize = 4
const DV: usize = 4
Ciphertext compression bit-width for the v half. 4 for
ML-KEM-512/768, 5 for ML-KEM-1024.
Source§const PUBLIC_KEY_BYTES: usize = 800
const PUBLIC_KEY_BYTES: usize = 800
Public encapsulation-key byte length.
K * 384 + 32 per FIPS 203 §6.Source§const SECRET_KEY_BYTES: usize = 1632
const SECRET_KEY_BYTES: usize = 1632
Secret decapsulation-key byte length.
24*K*N/8 + 96 per FIPS 203 §6.1.Source§const CIPHERTEXT_BYTES: usize = 768
const CIPHERTEXT_BYTES: usize = 768
Ciphertext byte length.
32*(K*DU + DV) per FIPS 203 §6.Source§const ALGORITHM_ID: &'static str = "ML-KEM-512"
const ALGORITHM_ID: &'static str = "ML-KEM-512"
Stable algorithm identifier —
"ML-KEM-512", "ML-KEM-768",
or "ML-KEM-1024".Source§const OID: &'static str = "2.16.840.1.101.3.4.4.1"
const OID: &'static str = "2.16.840.1.101.3.4.4.1"
Object identifier —
2.16.840.1.101.3.4.4.{1,2,3}.Source§type PublicKeyBytes = [u8; 800]
type PublicKeyBytes = [u8; 800]
Concrete encapsulation-key byte buffer type. Each impl
instantiates as
[u8; PUBLIC_KEY_BYTES].Source§type SecretKeyBytes = [u8; 1632]
type SecretKeyBytes = [u8; 1632]
Concrete decapsulation-key byte buffer type. Each impl
instantiates as
[u8; SECRET_KEY_BYTES]. Zeroized on drop
at the wrapper level (see crate::ml_kem).Source§type CiphertextBytes = [u8; 768]
type CiphertextBytes = [u8; 768]
Concrete ciphertext byte buffer type. Each impl instantiates
as
[u8; CIPHERTEXT_BYTES].Source§fn zero_public_key() -> Self::PublicKeyBytes
fn zero_public_key() -> Self::PublicKeyBytes
Create a new zeroed public-key buffer. Helper so generic code
can construct buffers without naming the concrete array size.
Source§fn zero_secret_key() -> Self::SecretKeyBytes
fn zero_secret_key() -> Self::SecretKeyBytes
Create a new zeroed secret-key buffer.
Source§fn zero_ciphertext() -> Self::CiphertextBytes
fn zero_ciphertext() -> Self::CiphertextBytes
Create a new zeroed ciphertext buffer.
Source§const SHARED_SECRET_BYTES: usize = 32
const SHARED_SECRET_BYTES: usize = 32
Shared-secret length in bytes. Always 32.
impl StructuralPartialEq for MlKem512
Auto Trait Implementations§
impl Freeze for MlKem512
impl RefUnwindSafe for MlKem512
impl Send for MlKem512
impl Sync for MlKem512
impl Unpin for MlKem512
impl UnsafeUnpin for MlKem512
impl UnwindSafe for MlKem512
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