TestU01#

Module for interacting with TestU01.

This module provides the test_file() function to test a file of random data using the NIST battery of tests implemented by TestU01.

A modified version of TestU01 is bundled with crypto-condor, which adds the NIST battery from the existing tests. This version has to compiled and installed locally: it requires make and gcc to compile. Installation is done with install_testu01(), which should be called by any function in this module that uses TestU01.

Installation#

crypto_condor.primitives.TestU01.get_testu01_dir()#

Returns the installation path of TestU01.

crypto_condor.primitives.TestU01.install_testu01(*, debug=False)#

Installs TestU01.

Checks if the path returned by get_testu01_dir() exists. If not, copies the necessary files to that path. It then checks whether TestU01 is compiled, and compiles it if not.

Keyword Arguments:

debug – If True, the compilation output is not captured by subprocess, displaying the full output on stdout.

Testing a file#

crypto_condor.primitives.TestU01.test_file(filename, *, bit_count=0)#

Tests the output of a PRNG using TestU01.

Parameters:

filename (str) – The name of the file to test.

Keyword Arguments:

bit_count – The number of bits to read, must be less or equal to the size of the file.

Returns:

The results obtained from testing the file, None if the test could not be run (e.g. compilation error).

Return type:

Results | None