ML-KEM

Category 1

NistyPQC.MLKEM.Category1.generate_keysFunction
generate_keys([; z, d])

Return a tuple (; ek, dk) consisting of an encapsulation key and the corresponding decapsulation key. The length of ek will be 800 bytes and the length of dk 1632 bytes.

For a deterministic result, a seed z of 32 bytes for implicit rejection and another seed d of 32 bytes for key generation can be provided.

source
NistyPQC.MLKEM.Category1.encapsulate_secretFunction
encapsulate_secret(ek[; m])

Return a tuple (; K, c) consisting of a shared secret K and a ciphertext c from which K can be recomputed with the decapsulation key dk that corresponds to ek. The parameter ek must be a valid encapsulation key of 800 bytes. The length of K will be 32 bytes and the length of c 768 bytes.

For a deterministic result, a plaintext m of 32 bytes can be provided.

source
NistyPQC.MLKEM.Category1.decapsulate_secretFunction
decapsulate_secret(c, dk)

Return the secret key K in case of successful decapsulation. Otherwise implicitly reject, i.e. return a deterministic value K derived from c and dk. The parameter c must have 768 bytes and dk 1632 bytes. Both for successful and failed decapsulation, K will have a length of 32 bytes.

source

Category 3

NistyPQC.MLKEM.Category3.generate_keysFunction
generate_keys([; z, d])

Return a tuple (; ek, dk) consisting of an encapsulation key and the corresponding decapsulation key. The length of ek will be 1184 bytes and the length of dk 2400 bytes.

For a deterministic result, a seed z of 32 bytes for implicit rejection and another seed d of 32 bytes for key generation can be provided.

source
NistyPQC.MLKEM.Category3.encapsulate_secretFunction
encapsulate_secret(ek[; m])

Return a tuple (; K, c) consisting of a shared secret K and a ciphertext c from which K can be recomputed with the decapsulation key dk that corresponds to ek. The parameter ek must be a valid encapsulation key of 1184 bytes. The length of K will be 32 bytes and the length of c 1088 bytes.

For a deterministic result, a plaintext m of 32 bytes can be provided.

source
NistyPQC.MLKEM.Category3.decapsulate_secretFunction
decapsulate_secret(c, dk)

Return the secret key K in case of successful decapsulation. Otherwise implicitly reject, i.e. return a deterministic value K derived from c and dk. The parameter c must have 1088 bytes and dk 2400 bytes. Both for successful and failed decapsulation, K will have a length of 32 bytes.

source

Category 5

NistyPQC.MLKEM.Category5.generate_keysFunction
generate_keys([; z, d])

Return a tuple (; ek, dk) consisting of an encapsulation key and the corresponding decapsulation key. The length of ek will be 1568 bytes and the length of dk 3168 bytes.

For a deterministic result, a seed z of 32 bytes for implicit rejection and another seed d of 32 bytes for key generation can be provided.

source
NistyPQC.MLKEM.Category5.encapsulate_secretFunction
encapsulate_secret(ek[; m])

Return a tuple (; K, c) consisting of a shared secret K and a ciphertext c from which K can be recomputed with the decapsulation key dk that corresponds to ek. The parameter ek must be a valid encapsulation key of 1568 bytes. The length of K will be 32 bytes and the length of c 1568 bytes.

For a deterministic result, a plaintext m of 32 bytes can be provided.

source
NistyPQC.MLKEM.Category5.decapsulate_secretFunction
decapsulate_secret(c, dk)

Return the secret key K in case of successful decapsulation. Otherwise implicitly reject, i.e. return a deterministic value K derived from c and dk. The parameter c must have 1568 bytes and dk 3168 bytes. Both for successful and failed decapsulation, K will have a length of 32 bytes.

source