A professional hardware-based True Random Number Generator (TRNG) that harvests pure, unpredictable physical entropy from thermal/shot noise (avalanche breakdown in a reverse-biased p-n junction).
The system features an embedded firmware core utilizing a cryptographic Von Neumann Extractor to eliminate hardware bias, coupled with a highly defensive Python client to securely deliver cryptographic keys (e.g., AES-256) to host applications.
- Quantum Physics Entropy Source: Captures raw avalanche noise from a hardware transistor junction β immune to mathematical or AI/ML predictive analysis.
- Von Neumann Debiasing: Embedded real-time bit purging ensures an exact 50/50 statistical distribution of
0s and1s. - Dual Operating Modes: Preprocessor pre-compiled toggle allows effortless switching between browser-based Wokwi Simulation and high-speed Physical Hardware Production.
- Production-Grade Client: Python backend protected against serial stream corruption, auto-flushes buffers, and handles bad data safely.
The repository follows a clean, professional architecture separating source code from assets and engineering specifications:
βββ src/
β βββ arduino/
β β βββ entropy_shield.ino # Microcontroller firmware (C++) with Preprocessor Toggles
β βββ python/
β β βββ main.py # Safe COM-Port Host Client & Cryptographic Key Assembler
β βββ documentation/
β βββ connection_guide.txt # [EN/RU] Step-by-step physical circuit wiring matrix
β βββ documentation_en.txt # [EN] Exhaustive technical and mathematical report
β βββ documentation_ru.txt # [RU] ΠΠΎΠ΄ΡΠΎΠ±Π½ΡΠΉ Π½Π°ΡΡΠ½ΠΎ-ΡΠ΅Ρ
Π½ΠΈΡΠ΅ΡΠΊΠΈΠΉ ΠΎΡΡΠ΅Ρ ΠΏΠΎ ΠΏΡΠΎΠ΅ΠΊΡΡ
β βββ wokwi_simulation.txt # [EN/RU] Instant web-simulator direct links
β βββ schematic.png # Visual circuit reference and operational wiring diagram
βββ .gitignore # Multi-language build artifacts filter
βββ README.md # Main documentation portal (This file)
For ultra-deep technical breakdowns, please refer directly to the dedicated files inside the src/documentation/ directory.
- The Chaos Stage: A physical transistor (e.g., BC547) is subjected to reverse-bias voltage, creating an unpredictable avalanche breakdown of charge carriers.
- The Boost Stage: An operational amplifier (LM358) scales microvolt-level physical fluctuations into solid 0Vβ5V logic bounds.
- The Purge Stage: The Arduino samples the Least Significant Bit (LSB). The Von Neumann Filter inspects incoming bits in pairs:
10β Validated as101β Validated as000or11β Instantly dropped to kill hardware anomalies or power grid 50Hz hum.
- The Assembly Stage: The Python script reads the processed stream, checks byte validity against hexadecimal matrixes, and formats the output into structural keys.
To instantly test the pipeline without buying components:
- Open the direct link provided inside src/documentation/wokwi_simulation.txt.
- Ensure
#define WOKWI_EMULATION_MODE trueis active at the top of the firmware code. - Click Start Simulation β±οΈ. Open the built-in Serial Monitor on the bottom right to see the live high-entropy HEX output.
To deploy the project onto an actual hardware chip:
- Connect your device (Arduino Nano / Uno / Pro Micro) to your workstation via USB.
- Open src/arduino/entropy_shield.ino in Arduino IDE or PlatformIO.
- Set the operation flag to production mode:
#define WOKWI_EMULATION_MODE false
- Select the correct board model and COM-port, then hit Upload.
The host python client handles secure collection from the system bus.
- Navigate into your local project root and install the hardware communication layer:
pip install pyserial
- Open src/python/main.py and verify the
SERIAL_PORTvariable matches your operating system configuration:- Windows:
'COM3','COM4', etc. - Linux / macOS:
'/dev/ttyUSB0','/dev/ttyACM0'
- Windows:
- Execute the generator engine to harvest a secure 256-bit key:
python src/python/main.py
When transitioning to real-world deployment (WOKWI_EMULATION_MODE false), the hardware layer requires isolated amplification.
Below is an abstract reference of the layout. For exact resistor values and safety decoupling parameters, consult the comprehensive src/documentation/connection_guide.txt.
[12V/9V Rail] βββ[100kΞ©]ββββ
β
(BC547 NPN) βββ[Collector Floating π¨]
β
[GND] ββββββββββββββββββββ΄βββ[100nF Cap]ββββΊ [LM358 Op-Amp] ββββΊ Arduino [A0]
A pre-rendered wiring blueprint is available for inspection at src/documentation/schematic.png.
Distributed under the MIT License. This software and hardware reference architecture is developed strictly for educational, defensive security research, and personal cryptographic experimentation.
π οΈ LNL-Engineering β Building secure architectures through physical entropy.
π¬ Personal Profile: @loanelly
