Skip to content

Commit ba92f0d

Browse files
authored
Merge pull request #118 from joshuaehill/MMCLZ78YSELFTEST
A bunch of changes to fix the MultiMMC / LZ78Y predictors, and add self tests.
2 parents 9f203ca + a9c2489 commit ba92f0d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2495
-748
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ ea_iid
77
ea_non_iid
88
ea_conditioning
99
ea_restart
10+
ea_transpose
1011
.vscode

README.md

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Cryptographic random bit generators (RBGs), also known as random number generato
44

55
## Disclaimer
66

7-
Please note that this code package was published to assist in the evaluation of the entropy estimation methods provided in SP800-90B. As such, it is written to resemble the pseudocode in the specification, and is not necessarily optimized for performance.
8-
97
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.
108

119
## Issues
@@ -18,43 +16,80 @@ This code package requires a C++11 compiler. The code uses OpenMP directives, so
1816

1917
The resulting binary is linked with bzlib and divsufsort, so these libraries (and their associated include files) must be installed and accessible to the compiler.
2018

19+
See [the wiki](https://github.com/usnistgov/SP800-90B_EntropyAssessment/wiki/Installing-libdivsufsort) for some distribution-specific instructions on installing divsufsort.
20+
2121
## Overview
2222

23-
* `bin/` has a bunch of randomly generated binary files for testing
23+
* `bin/` has binary files for testing
2424
* `cpp/` holds the new codebase
2525

2626
## How to run
2727

28-
The project is divided into two sections, IID tests and non-IID tests. They are intended to be separate. One provides an assurance that a dataset is IID [(independent and identically distributed)](https://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables) and the other provides an estimate for min-entropy for any data provided.
28+
The project is divided into two sections, IID tests and non-IID tests. They are intended to be separate. One provides an assurance that a dataset is IID [(independent and identically distributed)](https://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables) and the other provides an estimate for min-entropy for any data provided. Please note that most commonly used entropy sources are not IID; see IG7.18 for the additional justification necessary to support any IID claim.
29+
30+
One can make all the binaries using:
31+
32+
make
33+
34+
After compiling, one can test that your compilation behaves as expected by using the self-test functionality:
35+
cd selftest
36+
./selftest
37+
38+
Any observed delta less than 1.0E-6 is considered a pass for the self test.
2939

3040
For IID tests use the Makefile to compile the program:
3141

3242
make iid
3343

3444
Then you can run the program with
3545

36-
./ea_iid <binary_file> <bits_per_word> <-i|-c> <-a|-t> [-v]
46+
./ea_iid [-i|-c] [-a|-t] [-v] [-l <index>,<samples>] <file_name> [bits_per_symbol]
3747

38-
Look at the Makefile for an example. You must specify either `-i` or `-c`, and either `-a` or `-t`. These correspond to the following:
48+
You must specify either `-i` or `-c`, and either `-a` or `-t`. These correspond to the following:
3949

40-
* `-i`: Indicates the data is unconditioned and returns an initial entropy estimate
50+
* `-i`: Indicates the data is unconditioned and returns an initial entropy estimate. This is the default.
4151
* `-c`: Indicates the data is conditioned
42-
* `-a`: Estimates the entropy for all data in the binary file
43-
* `-t`: Truncates the binary file to the first one million bits
44-
45-
All provided binaries are stored in the `bin/` folder, but if you have one you want to test, just link it using a relative path from the executable.
52+
* `-a`: Estimates the entropy for all data in the binary file. This is the default.
53+
* `-t`: Truncates the created bitstring representation of data to the first one million bits.
54+
* `-l`: Reads (at most) <samples> data samples after indexing into the file by <index> * <samples> bytes.
55+
* `-v: Optional verbosity flag for more output. Can be used multiple times.
56+
* bits_per_symbol are the number of bits per symbol. Each symbol is expected to fit within a single byte.
4657

47-
To run the non-IID tests, use the following command to compile:
58+
To run the non-IID tests, use the Makefile to compile:
4859

4960
make non_iid
5061

51-
Running works the same way but without the threading flag. This looks like
62+
Running this works the same way. This looks like
63+
64+
./ea_non_iid [-i|-c] [-a|-t] [-v] [-l <index>,<samples> ] <file_name> [bits_per_symbol]
65+
66+
To run the restart testing, use the Makefile to compile:
67+
make restart
68+
69+
Running this is similar.
70+
./ea_restart [-i|-n] [-v] <file_name> [bits_per_symbol] <H_I>
71+
72+
* `-i`: Indicates IID data.
73+
* `-n`: Indicates non-IID data.
74+
* `-v`: Optional verbosity flag for more output. Can be used multiple times.
75+
* bits_per_symbol are the number of bits per symbol. Each symbol is expected to fit within a single byte.
76+
* `H_I` is the assessed entropy.
77+
78+
To calculate the entropy reduction due to conditioning, use the Makefile to compile:
79+
make conditioning
80+
81+
Running this is similar.
82+
./ea_conditioning [-v] <n_in> <n_out> <nw> <h_in>
5283

53-
./ea_non_iid <binary_file> <bits_per_word> <-i|-c> <-a|-t> [-v]
84+
* `-v`: Optional verbosity flag for more output. Can be used multiple times.
85+
* `n_in`: The number of bits entering the conditioning step per output.
86+
* `n_out`: The number of bits per conditioning step output.
87+
* `nw`: The narrowest width of the conditioning step.
88+
* `h_in`: The amount of entropy entering the conditioning step per output. Must be less than n_in.
5489

5590
## Make
5691

57-
A `Makefile` is provided with examples of these commands. Take a look at the file before using though as there is no default action.
92+
A `Makefile` is provided.
5893

5994
## More Information
6095

bin/biased-random-bits.bin

977 KB
Binary file not shown.

bin/biased-random-bytes.bin

977 KB
Binary file not shown.

bin/data.pi.bin

100755100644
File mode changed.

bin/normal.bin

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

bin/randData.bin

-977 KB
Binary file not shown.

bin/randData1.bin

-977 KB
Binary file not shown.

bin/ringOsc-nist.bin

977 KB
Binary file not shown.

bin/truerand_1bit.bin

100755100644
File mode changed.

0 commit comments

Comments
 (0)