rok::core::crypto::mlkem
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
MlKem768
pub struct MlKem768ML-KEM-768 key encapsulation. The functions are the deterministic
_internal forms: the caller supplies the random seeds.
pub const ENCAPSULATION_KEY_LEN: usize = 1184pub const DECAPSULATION_KEY_LEN: usize = 2400pub const CIPHERTEXT_LEN: usize = 1088pub const SHARED_KEY_LEN: usize = 32pub fn keygen(d: Bytes, z: Bytes) throws (ValueError) -> (List<u8>, Secret)KeyGen from 32-byte seeds
dandz:(ek, dk).pub fn encapsulate(ek: Bytes, m: Bytes) throws (ValueError) -> (Secret, List<u8>)Encaps with the 32-byte message
m:(shared key, ciphertext).ekmust pass the length and modulus checks (FIPS 203 7.2).pub fn decapsulate(dk: Bytes, c: Bytes) throws (ValueError) -> SecretDecaps: the shared key, or (implicit rejection) a key derived from
zandcwhencdoes not re-encrypt to itself.