package mlkem

  1. Overview
  2. Docs
Pure OCaml implementation of FIPS 203 ML-KEM

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.2.1.tar.gz
md5=cf10e50c23d778f822261222212229b8
sha512=3bd8ce7b420c82ddfaaaa173966be892ccfd7a50664c3db91c4e0b797942d2fdcabe6e240f400688ac19824290f9a0ee531db0e1e5782a6f04e745d1b6a2973c

doc/mlkem.for_testing/Mlkem_for_testing/index.html

Module Mlkem_for_testingSource

Deterministic FIPS 203 entry points for known-answer testing only.

This library exposes test entropy and expanded decapsulation keys. It must not be used by production protocols. Use the corresponding module from Mlkem instead.

Sourceval sha3_256 : string -> string
Sourceval sha3_512 : string -> string
Sourceval shake128 : output_length:int -> string -> string
Sourceval shake256 : output_length:int -> string -> string

Internal hash entry points exposed for primitive known-answer tests.

Sourceval ct_equal : string -> string -> int

The comparison behind implicit rejection: 1 if the two strings are equal, 0 otherwise, including when their lengths differ.

Sourceval keygen_512 : d:string -> z:string -> (string * string, Mlkem.Mlkem512.error) result
Sourceval encapsulate_512 : encapsulation_key:string -> randomness:string -> (string * string, Mlkem.Mlkem512.error) result
Sourceval decapsulate_512 : expanded_decapsulation_key:string -> ciphertext:string -> (string, Mlkem.Mlkem512.error) result
Sourceval keygen_768 : d:string -> z:string -> (string * string, Mlkem.Mlkem768.error) result

Returns (expanded_decapsulation_key, encapsulation_key). Both d and z must be 32 bytes.

Sourceval encapsulate_768 : encapsulation_key:string -> randomness:string -> (string * string, Mlkem.Mlkem768.error) result

Returns (ciphertext, shared_secret) using the supplied 32-byte test randomness.

Sourceval decapsulate_768 : expanded_decapsulation_key:string -> ciphertext:string -> (string, Mlkem.Mlkem768.error) result

Decapsulates an ACVP-format 2400-byte key.

Sourceval keygen_1024 : d:string -> z:string -> (string * string, Mlkem.Mlkem1024.error) result
Sourceval encapsulate_1024 : encapsulation_key:string -> randomness:string -> (string * string, Mlkem.Mlkem1024.error) result
Sourceval decapsulate_1024 : expanded_decapsulation_key:string -> ciphertext:string -> (string, Mlkem.Mlkem1024.error) result