atjersland / RNG-RD

Hardware random bit generator using a radioactive noise source

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Random Number Generator - Radioactive Decay (RNG-RD)

Description

This hardware Random Bit Generator(RBG) relies on radioactive decay as an entropy source for generating random bits. While striving to adhere to the guidelines outlined in NIST SP800-90B, this project does not provide any guarantees regarding full compliance. The primary goal of this project is to serve as a self-contained source of random bits for integration into various personal projects while following best practices.

Table of contents

  1. Bit Generation
    1. Entropy Source
    2. Post Processing
    3. Output Format
  2. Entropy Validation
    1. Summary of Results
    2. Full Assessment Results
  3. Device Construction
    1. Bill of Materials (BOM)
    2. Software Bill of Materials (SBOM)
    3. RPi 4b to Geiger Kit Wire Diagram
  4. Potential Improvements
  5. References

Bit Generation

Entropy Source

The entropy source is the natural decay of thorium oxide found in 2% thoriated welding rods. Measured using an SBM-20 Geiger-Muller tube.

Post Processing

This device employs a post-processing step during digitization, where it compares the intervals between two pairs of pulses to determine whether to output a '1' or '0'.

if(timestamps[1] - timestamps[0] == timestamps[3] - timestamps[2]):
    enough_times = False
    continue
                    
if(timestamps[1] - timestamps[0] > timestamps[3] - timestamps[2]):
    pending_bits.extend(bitarray('0'))
else:
    pending_bits.extend(bitarray('1'))

The original purpose of this process was to mitigate timing discrepancies caused by the low-power hardware initially utilized for this process. This approach similarly mitigates timing inaccuracies stemming from the hardware and software choices of this device.

This post-processing method was originally developed and is comprehensively explained by HotBits.

Output Format

The output consists of 256-byte(2048-bit) binary files with filenames consisting of SHA3-256 hashes of when the file was written.

This naming scheme is intended to maintain a distinct identifier while concealing the specific creation timestamps.

The file size was chosen to prevent waste, as each file can only be used once for a single purpose. Smaller files that can be easily concatenated when needed minimizes the amount of wasted bits.

Entropy Validation

The output of this RBG was tested using the entropy measurement tools described in NIST SP800-90B using the implementation published by The US NIST at usnistgov/SP800-90B_EntropyAssessment.

The binary data was tested as an Independent and Identically Distributed(IID) source with no conditioning.

./ea_iid -i -a -v output.bin

Summary of Results:

Calculating baseline statistics...
    Raw Mean: 0.507345
    Median: 0.500000
    Binary: true

Passed chi square tests

Passed length of longest repeated substring test

Passed IID permutation tests

Full Assessment Results

Device Construction

hardwareImage

Bill of Materials (BOM)

  • SBM-20 Geiger-Muller Tube
  • Generic Geiger-Muller counter kit with output pins for analogue outputs
  • Raspberry Pi 4 Model B with case
  • 2% Thoriated Welding Rods diameter: 1.6mm length: 175mm

Software Bill of Materials (SBOM)

  • Ubuntu Server 23.10 for Raspberry Pi
  • Python 3
  • RPi.GPIO (system package)
  • bitarray (PyPi)
  • hashlib (default package)
  • Time (default package)

RPi 4b to Geiger Kit Wire Diagram

Wiring Diagram

The data output pin on the geiger-muller counter is incorrectly labeled as "VIN"

Potential Improvements

  • Switching to a dedicated ESP32 board.

    • This improvement enables better interrupt timings and fewer missed pules that could be used for bit generation.
  • Wiring additional Geiger-Muller kits to the RPi 4b.

    • Processing the pulses from each device in parallel would increase the output of bits from the device. These additional detectors would need to be isolated from each other to avoid interference between detectors.
  • Switching to a radiation source with more activity

    • This would result in increased detections per second and consequently an increase in the generated bits per second.

References

About

Hardware random bit generator using a radioactive noise source

License:GNU General Public License v3.0


Languages

Language:Python 100.0%