To check the randomness of a series of bits using the SP800-90B_EntropyAssessment repository, follow these steps:
1. Prerequisites
Ensure you have the required dependencies installed and the repository compiled:
Dependencies: The repository requires a C++11 compiler with OpenMP support and several libraries: libbz2-dev, libdivsufsort-dev, libjsoncpp-dev, libssl-dev, libmpfr-dev, etc.
Compiling: Navigate to the repository root and run make to compile the codebase:
bash
make
2. Input File Preparation
Prepare your data as a binary file containing the series of bits you want to test.
The file must contain at least 1 million samples (bits or symbols).
If your bits are stored in text form (e.g., 101010...), convert them to a binary file format where each bit is packed into bytes or symbols. You can use Python or other tools for this conversion.
3. Running Tests
The repository provides several tools for randomness testing, primarily targeting IID (independent and identically distributed) and non-IID data. Here's how to run these tests:
The tools compute various entropy estimates to assess the randomness of the input data. Here’s what the key outputs mean:
H_original: The estimated min-entropy based on the original symbols.
H_bitstring: The estimated min-entropy after converting the data into a bitstring.
Min-Entropy (H_I): The minimum of all entropy estimates, representing the worst-case entropy.
Pass/Fail Criteria
IID Tests: If the min-entropy (H_I) is close to the theoretical maximum (e.g., 1 bit per symbol for binary data), the data is considered highly random.
Non-IID Tests: Multiple tests are run (e.g., Collision Test, Markov Test, Compression Test). If all tests agree that the min-entropy is sufficiently high, the data is considered random.
Threshold for Sufficient Randomness:
If H_I is close to the maximum possible value (bits_per_symbol), the data is considered sufficiently random.
If H_I is much lower than the maximum or fails certain tests, the data might not be sufficiently random.
Verbose Output
Use the -v option for detailed insights into each test. This will help you identify which specific tests your data passes or fails and debug any potential issues.
5. Example Workflow
Assume your binary file is testdata.bin, containing 1 million bits (1 bit per symbol):
Run IID Tests:
bash
./ea_iid -i -a -v testdata.bin 1
Run Non-IID Tests:
bash
./ea_non_iid -i -a -v testdata.bin 1
Check the results:
Look for the min-entropy (H_I) in the output.
Compare it to the maximum possible entropy for your data (1 bit for binary data). If the min-entropy is significantly lower, your data may not be sufficiently random.
6. Additional Tools
Restart Tests: For specialized restart entropy testing: