package mlkem768

Import Path
	crypto/internal/mlkem768 (on go.dev)

Dependency Relation
	imports 5 packages, and imported by one package

Involved Source Files Package mlkem768 implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber). Only the recommended ML-KEM-768 parameter set is provided. The version currently implemented is the one specified by [NIST FIPS 203 ipd], with the unintentional transposition of the matrix A reverted to match the behavior of [Kyber version 3.0]. Future versions of this package might introduce backwards incompatible changes to implement changes to FIPS 203.
Package-Level Type Names (only one)
/* sort by: | */
A DecapsulationKey is the secret key used to decapsulate a shared key from a ciphertext. It includes various precomputed values. // A[i*k+j] = sampleNTT(ρ, j, i) Bytes returns the extended encoding of the decapsulation key, according to FIPS 203 (DRAFT). EncapsulationKey returns the public encapsulation key necessary to produce ciphertexts. func GenerateKey() (*DecapsulationKey, error) func NewKeyFromExtendedEncoding(decapsulationKey []byte) (*DecapsulationKey, error) func NewKeyFromSeed(seed []byte) (*DecapsulationKey, error) func Decapsulate(dk *DecapsulationKey, ciphertext []byte) (sharedKey []byte, err error)
Package-Level Functions (total 5)
Decapsulate generates a shared key from a ciphertext and a decapsulation key. If the ciphertext is not valid, Decapsulate returns an error. The shared key must be kept secret.
Encapsulate generates a shared key and an associated ciphertext from an encapsulation key, drawing random bytes from crypto/rand. If the encapsulation key is not valid, Encapsulate returns an error. The shared key must be kept secret.
GenerateKey generates a new decapsulation key, drawing random bytes from crypto/rand. The decapsulation key must be kept secret.
NewKeyFromExtendedEncoding parses a decapsulation key from its FIPS 203 (DRAFT) extended encoding.
NewKeyFromSeed deterministically generates a decapsulation key from a 64-byte seed in the "d || z" form. The seed must be uniformly random.
Package-Level Constants (total 5)
const CiphertextSize = 1088
const DecapsulationKeySize = 2400
const EncapsulationKeySize = 1184
const SeedSize = 64
const SharedKeySize = 32