Skip to main content

SP 800-90B entropy assesment

Project description

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.

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

sp800_90b-0.1.1.tar.gz (52.5 kB view details)

Uploaded Source

File details

Details for the file sp800_90b-0.1.1.tar.gz.

File metadata

  • Download URL: sp800_90b-0.1.1.tar.gz
  • Upload date:
  • Size: 52.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sp800_90b-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b16ccebd3120b2c27cda0305ee8a76c566943423b992681db3bcfbf0a8a084a0
MD5 047c0114fa2a89bde7ef11546b50cf6c
BLAKE2b-256 07130abc8d50f88c66aa4febb0aa98cbc9af6e3fcb36cfb17d2aced5f3c45770

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