core::crypto::mlkem
API 参考只有英文版,由标准库源代码中的英文文档注释生成。
ML-KEM-768 (FIPS 203): k = 3, eta1 = eta2 = 2, du = 10, dv = 4.
Polynomials are 256 coefficients in [0, q) held in secret storage
(SecretWords; a vector of k polynomials is one buffer of 256k), and
so are the secret seeds, keys and messages. Secret values never
steer a branch or an index: reduction is an exact multiply-shift
division by q, the re-encryption compare and the implicit-rejection
key select are masks. Only the rejection sampling of the public
matrix branches.
Structs
DecapsulationKey768Source
pub struct DecapsulationKey768An ML-KEM-768 decapsulation key (the 2400-byte expanded encoding)
in secret storage. It has one owner (let b = a moves it); wipe
and its release clear it.
Sourcepub fn from_seed<D: AsBytes, Z: AsBytes>(§d: D, z: Z) throws (ValueError) -> DecapsulationKey768 KeyGen from 32-byte seeds
dandz(the deterministic_internalform: the caller supplies the random seeds).
Sourcepub fn from_expanded_bytes<B: AsBytes>(§bytes: B) throws (ValueError) -> DecapsulationKey768 From the 2400-byte expanded encoding
dk_pke || ek || H(ek) || z(FIPS 203 7.3): the low-level form, for keys stored expanded. The storedH(ek)must match the encapsulation key.A copy of the 2400-byte expanded encoding.
Sourcepub fn encapsulation_key(§self) -> EncapsulationKey768 The public key that pairs with this one.
Sourcepub fn decapsulate<C: AsBytes>(§self, c: C) throws (ValueError) -> Secret Decaps: the shared key, or (implicit rejection) a key derived from
zandcwhencdoes not re-encrypt to itself.Overwrite the key with zeros now (every copy shares it).
EncapsulationKey768Source
pub struct EncapsulationKey768An ML-KEM-768 encapsulation key, checked (FIPS 203 7.2).
The encoded key length in bytes.
The ciphertext length in bytes.
Sourcepub fn from_bytes<B: AsBytes>(§bytes: B) throws (ValueError) -> EncapsulationKey768 From the 1184-byte encoding: every coefficient below q (the modulus check of FIPS 203 7.2).
The key's encoded bytes.
Encaps with the 32-byte message
m(the deterministic_internalform):(shared key, ciphertext).
Trait implementations 1
impl Debug for EncapsulationKey768
Constants
SHARED_KEY_LENSource
pub const SHARED_KEY_LEN: usize = 32The shared key length.