SHAKE#

How to use the crypto_condor.primitives.SHAKE module to test implementations of SHAKE128 and SHAKE256.

Supported parameters#

This module can test implementations of both SHAKE128 and SHAKE256, as indicated by the Algorithm enum.

Implementations can be either bit- or byte-oriented. To select an orientation use the Orientation enum.

enum crypto_condor.primitives.SHAKE.Algorithm(value)#

Supported extensible output functions.

Member Type:

str

Valid values are as follows:

SHAKE128 = <Algorithm.SHAKE128: 'SHAKE128'>#
SHAKE256 = <Algorithm.SHAKE256: 'SHAKE256'>#
enum crypto_condor.primitives.SHAKE.Orientation(value)#

Orientation of the implementation.

Member Type:

str

Valid values are as follows:

BIT = <Orientation.BIT: 'bit'>#
BYTE = <Orientation.BYTE: 'byte'>#

Test an implementation directly#

crypto_condor.primitives.SHAKE.test(xof, xof_algorithm, orientation)#

Tests a SHAKE implementation.

Runs NIST test vectors on the given function. The function to test must conform to the Xof protocol.

Parameters:
  • xof (Xof) – The function to test.

  • xof_algorithm (Algorithm) – The algorithm of the XOF to test.

  • orientation (Orientation) – The orientation of the implementation, either bit- or byte-oriented.

Returns:

A ResultsDict containing the results of short message (short), long message (long), Monte-Carlo (monte-carlo), and variable length (variable) tests. The keys are SHAKE/<algorithm>/<type>.

Return type:

ResultsDict

Run a wrapper#

Note

Available wrappers are defined by Wrapper.

crypto_condor.primitives.SHAKE.run_wrapper(language, xof_algorithm, orientation)#

Runs the corresponding wrapper.

Parameters:
  • language (Wrapper) – The language of the wrapper to run.

  • xof_algorithm (Algorithm) – The algorithm of the XOF to test.

  • orientation (Orientation) – The orientation of the implementation, either bit- or byte-oriented.

enum crypto_condor.primitives.SHAKE.Wrapper(value)#

Defines the available wrappers.

Member Type:

str

Valid values are as follows:

PYTHON = <Wrapper.PYTHON: 'Python'>#

Protocols#

protocol crypto_condor.primitives.SHAKE.Xof#

Represents a XOF.

XOFs must behave like __call__ to be tested with this module.

Classes that implement this protocol must have the following methods / attributes:

__call__(data, output_length)#

Produces digests of any desired length.

Parameters:
  • data (bytes) – The input data.

  • output_length (int) – The desired length of the digest in bytes.

Returns:

The digest of the desired length.

Return type:

bytes