crypto-img

Running NIST STS 2.1.2

Devontae Reid
Devontae Reid
Cryptography Randomness Testing Security Encryption

Topic: NIST STS 2.1.2

Date: [MM/DD/YYYY]

Source: [NIST SP800-22, Software Documentation, Personal Testing]


Key Points

  • NIST STS is used to assess the randomness of binary sequences.
  • Includes multiple tests defined in the NIST SP800-22 publication.
  • Requires a properly formatted bitstream as input.
  • Must be built using make and gcc on a Unix-like system.
  • Test results are stored in the experiments/ directory.

Examples & Details

โœ… Prerequisites
  • Linux/macOS/WSL/Cygwin with:

    • make
    • gcc
  • Terminal and file access

๐Ÿ“ฆ Download and Extract
                    unzip sts-2.1.2.zip
                    cd sts-2.1.2
                  
                
๐Ÿ› ๏ธ Build the Suite
                  make
                
              
๐Ÿงช Input File Format
  • Pure 0s and 1s, no headers, no whitespace.

  • Example:

                        01010011010101...
                      
                    
๐Ÿ Run the Suite
              ./assess 1000000
            
          

Interactive options:

  1. Input file
  2. Select tests
  3. Run tests
  4. View results
  5. Exit

Follow steps: 0 โ†’ 1 โ†’ 2 โ†’ 3 โ†’ 0

๐Ÿ“ Output

Stored in:

          experiments/AlgorithmTesting/
          โ”œโ”€โ”€ data.epsilon
          โ”œโ”€โ”€ results.txt
          โ”œโ”€โ”€ stats.txt
        
      

Each test result includes logs and summaries.

๐Ÿงช Common Test Numbers
Test # Name
1 Frequency (Monobit)
2 Block Frequency
3 Runs
4 Longest Run of Ones
5 Rank
6 Discrete Fourier Transform
7 Non-overlapping Template

Questions & Clarifications

  • How are thresholds for p-values determined across different tests?
  • What is the statistical basis for deciding pass/fail?
  • Can custom test suites be integrated?

Action Items / Next Steps

  • Automate test run with subprocess/Python
  • Generate visual summaries of p-value distributions
  • Compare test results across multiple RNG implementations
  • Read SP800-22 full documentation

Summary

NIST STS 2.1.2 is a powerful suite for validating the statistical randomness of bitstreams. After compiling the suite, a clean binary file of known length can be tested via an interactive CLI. Results are saved for inspection. Automation is possible using scripting, and understanding individual test behavior is key for interpreting results.

DR

Devontae Reid

Servant of Christ and a Senior Software Engineer with a passion for building innovative solutions that make a difference.

Contact

devontae.reid@gmail.com

Remote / Worldwide

ยฉ 2026 Devontae Reid. All rights reserved.