Kyber test vectors#

Test vectors for CRYSTALS-Kyber.

exception crypto_condor.vectors.Kyber.KyberVectorsError#

Bases: Exception

Exception for errors when loading vectors.

class crypto_condor.vectors.Kyber.KyberVectors(parameter_set, tests)#

Bases: object

A class to load Kyber test vectors.

Do not instantiate directly, use load() instead.

Parameters:
  • parameter_set (Paramset) – The parameter set of the vectors.

  • tests (list[KyberNistTest]) – A list of the test vectors for the given parameter set.

Example

Using load() to load the test vectors:

>>> from crypto_condor.vectors.Kyber import KyberVectors, Paramset
>>> vectors = KyberVectors.load(Paramset.KYBER512)
classmethod load(parameter_set)#

Loads Kyber test vectors.

Parameters:

parameter_set (Paramset) – The parameter set of the vectors to load.

Returns:

An instance of KyberVectors with the corresponding test vectors.

Raises:
  • FileNotFoundError – If the test vectors file was not found. This should not occur, as the vectors are bundled in the package.

  • KyberVectorsError – If an error occurred while importing the file.

enum crypto_condor.vectors.Kyber.Paramset(value)#

Bases: StrEnum

Available parameter sets.

Member Type:

str

Valid values are as follows:

KYBER512 = <Paramset.KYBER512: 'Kyber512'>#
KYBER512_90s = <Paramset.KYBER512_90s: 'Kyber512-90s'>#
KYBER768 = <Paramset.KYBER768: 'Kyber768'>#
KYBER768_90s = <Paramset.KYBER768_90s: 'Kyber768-90s'>#
KYBER1024 = <Paramset.KYBER1024: 'Kyber1024'>#
KYBER1024_90s = <Paramset.KYBER1024_90s: 'Kyber1024-90s'>#

The Enum and its members also have the following methods:

property sk_size#

The secret key size of the parameter set in bytes.

property pk_size#

The public key size of the parameter set in bytes.

property ct_size#

The ciphertext size of the parameter set in bytes.