Guides › NIST STS errors
NIST STS 2.1.2: common errors and fixes
The NIST Statistical Test Suite (sts-2.1.2) is the reference implementation of SP 800-22. It is also old C code with an interactive menu, and a few problems come up again and again.
Build problems
"multiple definition of …" when linking
GCC 10 and newer default to -fno-common, which rejects older C code that defines global variables in headers. If the link step fails with multiple definition errors, add -fcommon to the compiler flags in the makefile and rebuild:
# in makefile
CFLAGS = -O2 -fcommon
make clean && make
Building on macOS
On macOS gcc is usually Apple clang. If the makefile's flags are rejected, build with clang explicitly (make CC=clang) and fix warnings only if they stop the build. Running inside a Linux container (docker run -it -v "$PWD":/sts gcc bash) is often quicker than chasing compiler differences.
Every test fails, even on good data
- Wrong input format. The menu asks for
[0] ASCIIor[1] Binary. Raw bytes need[1]; a text file of0/1characters needs[0]. Reading text as binary tests the ASCII codes of "0" and "1" (0x30, 0x31), which are far from random. - Extra content in the file: a header line, hex formatting such as
0x3f,, line numbers, or printf output mixed into the data. - Repeated data: the same buffer written several times, or a generator re-seeded identically for each capture.
The input file guide shows how to write clean files from Python, C, Linux and microcontrollers.
Bitstreams and sequence length don't match the file
./assess 1000000 sets the length of each sequence; the menu then asks how many bitstreams to test. The file must contain at least length × bitstreams bits. A 1,000,000-byte binary file holds 8,000,000 bits, so it supports at most 8 sequences of 1,000,000 bits. Asking for more makes the run fail or test incomplete data, so the results are meaningless.
Missing result folders
Results are written under experiments/AlgorithmTesting/, one folder per test. If those folders were deleted or never unpacked, the run stops with errors about files it cannot open. Re-extract the original archive, or recreate the folder structure (the distribution ships a script for this in experiments/).
"Insufficient number of cycles"
The Random Excursions and Random Excursions Variant tests need at least 500 cycles of the ±1 random walk. With fewer, they are skipped for that sequence. That is not a failure. Even random million-bit sequences fall short fairly often (details and numbers).
Reading finalAnalysisReport.txt
- Each row is one test (or one template or state). The C1–C10 columns are the p-value histogram used for the uniformity check.
- P-VALUE is the uniformity result P-valueT; it should be at least 0.0001.
- PROPORTION is how many sequences passed. The bottom of the report states the minimum pass rate for your number of sequences.
- An asterisk marks a test outside the acceptable range.
See interpreting SP 800-22 p-values for how much a single failure means.
Skip the build. Upload a file and run all 15 SP 800-22 tests in your browser, free, with every p-value on screen.
Run the free testNISTTEST.COM is an independent implementation of NIST SP 800-22 Rev. 1a and is not affiliated with or endorsed by the National Institute of Standards and Technology.