Skip to main content

Randomness testing for humans

Project description

Randomness testing for humans

GitHub Workflow Status Documentation Status License PyPI package latest release Supported versions Tested with Hypothesis Code style

coinflip aims to implement the tests recommended by NIST SP800-22 to check random number generators for randomness. A user-friendly command-line interface provided allows you to run the tests on your data, and subsequently report on the results by generating informational HTML documents.

coinflip.randtests acts as the public API for notebook users and developers to use the randomness tests directly. The tests are implemented as general solutions, meaning they accept basically any sequence with two distinct elements!

https://raw.githubusercontent.com/Honno/coinflip/report/.video_files/thumb/thumb_thumb.png

Setup

You can get the latest release of coinflip from PyPI.

$ pip install coinflip

Alternatively you can get the (unstable) development version straight from GitHub.

$ pip install git+https://github.com/Honno/coinflip

If that means nothing to you, no fret! Please continue reading the instructions below.

Install Python 3.7+

Cross-platform installation instructions for Python are available at realpython.com/installing-python/.

Note coinflip only works on Python 3.7 or above. Make sure you have Python 3.7 (or higher) by checking the version of your installation:

$ python --version
Python 3.7.X

Clone repository

You can clone the source code via Git:

$ git clone https://github.com/Honno/coinflip

Install coinflip

Enter the directory coinflip is downloaded to:

$ cd coinflip

You can install coinflip via the pip module:

$ pip install -e .

pip is the standard package manager for Python, which should of installed automatically when installing Python 3.7+.

Trial run

Try running the randomness tests on an automatically generated binary sequence:

$ coinflip example-run

If the command coinflip is “not found”, you may need to add your local binaries folder to your shell’s path. For example, in bash you would do the following:

$ echo "export PATH=~/.local/bin:$PATH" >> ~/.bash_profile
$ source ~/.bash_profile

In the worst case, you can execute commands via python -m:

$ python -m coinflip example-run

Quick start

Randomness tests can be ran over your RNG output via the run command.

$ coinflip run DATA OUT
...

DATA is the path to newline-delimited text file that contains a binary sequence. An example file to use is available on my gist. Alternatively, raw binary files can be read as bitstreams via the --binary flag

OUT is the path where you want the results to be saved. The results will be saved as a pickle-serialised file, which can be viewed again via the read command. Additionally you can generate informational HTML reports from the results via the report command, but note that the reports are currently very lacking.

Output should comprise of the sequence parsed from DATA, test-specific result summaries, and a final overall summary table.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coinflip-0.1.1.2.tar.gz (240.4 kB view details)

Uploaded Source

Built Distribution

coinflip-0.1.1.2-py3-none-any.whl (53.9 kB view details)

Uploaded Python 3

File details

Details for the file coinflip-0.1.1.2.tar.gz.

File metadata

  • Download URL: coinflip-0.1.1.2.tar.gz
  • Upload date:
  • Size: 240.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.5

File hashes

Hashes for coinflip-0.1.1.2.tar.gz
Algorithm Hash digest
SHA256 50b5df51c251ede2ef45638b0ab9faf128c966039454ba4e77db6a3cd8b21c2c
MD5 c3ad428768fcbc9dc2c5ae28e1036c20
BLAKE2b-256 a4a95a30b716a122a47b49f7e62402e8330afdab7011aefe6f4879d74d4429c4

See more details on using hashes here.

File details

Details for the file coinflip-0.1.1.2-py3-none-any.whl.

File metadata

  • Download URL: coinflip-0.1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 53.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.5

File hashes

Hashes for coinflip-0.1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c54f44ac621cfb59c9a45219df4c008fecf954189e4f39ef98f6ccb69a57f5f4
MD5 20d56ff2cbd81d291d1b52449f5659ad
BLAKE2b-256 9f9e337b19d371d8893e2bdf6d7f7129a437a08822ad49f864b3e6aed635b334

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page