Skip to main content

Functional interface to the NIST randomness tests

Project description

sts-pylib

GitHub Workflow Status Read the Docs License PyPI Python Version

A functional Python interface to the NIST Statistical Test Suite.

Quickstart

You can install sts-pylib via pip:

$ pip install sts-pylib

This will install a package sts into your system, which contains NIST's statistical tests for randomness. A complete reference is available in the docs.

>>> import sts
>>> p_value = sts.frequency([1, 0, 1, 1, 0, 1, 0, 1, 0, 1])
	      FREQUENCY TEST
---------------------------------------------
COMPUTATIONAL INFORMATION:
(a) The nth partial sum = 2
(b) S_n/n               = 0.200000
---------------------------------------------
p_value = 0.527089
>>> print(p_value)
0.5270892568655381

Note that all the tests take the input sequence epsilon (a sample of RNG output) as an array of 0 and 1 integers.

A more thorough demonstration of sts-pylib is available on Kaggle.

Contributors

The original sts C program, alongside its corresponding SP800-22 paper, were authored by the following at NIST:

  • Andrew Rukhin
  • Juan Soto
  • James Nechvatal
  • Miles Smid
  • Elaine Barker
  • Stefan Leigh
  • Mark Levenson
  • Mark Vangel
  • David Banks,
  • Alan Heckert
  • James Dray
  • San Vo
  • Lawrence E Bassham III

Additional work to improve Windows compatibility was done by Paweł Krawczyk (@kravietz), with a bug fix by @ZZMarquis.

I (@Honno) am responsible for converting sts into a functional interface, and providing a Python wrapper on-top of it. You can check out my own randomness testing suite coinflip, where I am creating a robust and user-friendly version of NIST's sts in Python.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

sts_pylib-0.0.5-cp38-cp38-manylinux2010_x86_64.whl (104.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

sts_pylib-0.0.5-cp37-cp37m-manylinux2010_x86_64.whl (103.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

sts_pylib-0.0.5-cp36-cp36m-manylinux2010_x86_64.whl (103.7 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

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