Skip to main content

EntropyAssessment

Cryptographic random bit generators (RBGs), also known as random number generators (RNGs), require a noise source that produces digital outputs with some level of unpredictability, expressed as min-entropy. SP 800-90B provides a standardized means of estimating the quality of a source of entropy.

Documentation

View the documentation here (https://hnj2.github.io/sp800_90b/).

Installing

Prerequisites

You will need to have the bz2 and 'divsufsort' libraries installed, as well as a g++-compatible compiler that suports c++11. On debian/ubuntu like systems the following command sould be sufficient:

sudo apt install libbz2-dev libdivsufsort-dev build-essential

You should be using a virtual environment with at least python version 3.

Using pip

You can simply run:

pip install sp800-90b

Using setuptools

Don't forget to check out the nist_impl submodule:

git submodule init
git submodule update

You will also need the setuptools and the pybind11 python package:

pip install setuptools pybind11

Now you can install the package using:

python setup.py build
python setup.py install

Manual compilation

With the same prerequisites as in the setuptools installation you can also run

make -f Manual.make

to manually compile the package.

Note: You will only be able to use it in the directory where the generated .so library is present.

Installing

Use the python command help(sp800_90b) for documentation.

Manual test

The following commands can be used for a crude test of the package:

(venv) hnj@prokrastinator:~/sp800_90b$ python
Python 3.6.9 (default, Oct  8 2020, 12:12:24)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import random

In [2]: r = bytes(random.getrandbits(8) for _ in range(1000000))

In [3]: n = bytes(random.getrandbits(8) for _ in range(500000))

In [4]: n = n + bytes(random.getrandbits(7) for _ in range(500000))

In [5]: import sp800_90b

In [6]: help(sp800_90b)


In [7]: rd = sp800_90b.Data(r)

In [8]: rd.iid_tests()
Beginning initial tests...
Beginning permutation tests... these may take some time
Out[8]: True

In [9]: rd.h_initial()
Out[9]: 7.189185202883665

In [10]: nd = sp800_90b.Data(n)

In [11]: nd.iid_tests()
igamc: UNDERFLOW
Out[11]: False

In [12]: nd.h_initial()
Out[12]: 5.194695581531671

Disclaimer

This software is a repackaged and slightly modified version of a NIST-developed project (that can be found here: https://github.com/usnistgov/SP800-90B_EntropyAssessment).

Original NIST Disclaimer

NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software.

Modifications

The modifications that were made were are:

More Information

For more information on the nist code that is running, look into the original repository.

For more information on the estimation methods, see SP 800-90B.

Release files for sp800-90b 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sp800-90b 0.1.1
File Size Uploaded
sp800_90b-0.1.1.tar.gz 52.5 kB Details

Release files / sp800_90b-0.1.1.tar.gz

Download URL sp800_90b-0.1.1.tar.gz
Size 52.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b16ccebd3120b2c27cda0305ee8a76c566943423b992681db3bcfbf0a8a084a0
BLAKE2b-256 checksum
How to use checksums
07130abc8d50f88c66aa4febb0aa98cbc9af6e3fcb36cfb17d2aced5f3c45770
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

0.0.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page