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.
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 areSHAKE/<algorithm>/<type>
.- Return type:
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.
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