Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/microcontroleurmonde/esp32-c3_rng
A Micro-python library which provides an interface to generate a random number using the ESP32-C3's hardware RNG.
https://github.com/microcontroleurmonde/esp32-c3_rng
esp32-c3 micropython rng trng
Last synced: 10 days ago
JSON representation
A Micro-python library which provides an interface to generate a random number using the ESP32-C3's hardware RNG.
- Host: GitHub
- URL: https://github.com/microcontroleurmonde/esp32-c3_rng
- Owner: MicroControleurMonde
- License: cc0-1.0
- Created: 2024-12-15T07:00:32.000Z (11 days ago)
- Default Branch: main
- Last Pushed: 2024-12-15T08:16:28.000Z (11 days ago)
- Last Synced: 2024-12-15T08:16:50.866Z (11 days ago)
- Topics: esp32-c3, micropython, rng, trng
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ESP32-C3 RNG
---![Link](https://github.com/MicroControleurMonde/ESP32_RNG/blob/main/Reports/ESP32download.jpg)
A Micro-python library which provides an interface to generate a random number using the ESP32-C3's hardware RNG.
## Under Construction ...
A Micro-python library which provides an interface to generate a random number using the ESP32-C3's hardware RNG.
The code uses several hardware devices of the MCU to generate random noise values using additional entropy sources. The SAR ADC and Wi-Fi are exploited to provide quality inputs to the hardware random number generator integrated into the ESP32-C3. It reads a random value from the '**RNG_DATA_REG**' register.
This uses the same method to generate random numbers as the ESP32. Only the registry address changes (***0x600260B0***)
- Library : **esp32_c6_rng.py**
- Library test: **test_esp32_c6_rng.py****Source**: *`ESP32-C3 Technical Reference Manual V.1.1 - Chapter 25 Random Number Generator (RNG) - Pages 528/529`* - [link](https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf)
The ESP32-C6 RNG generates random integer numbers as **32-bit values**.
Random value #1: 146820682
Random value #2: -196285670
Random value #3: -866286180
Random value #4: -1000580641
Random value #5: 1642066338
Random value #6: -1467530287
Random value #7: -697217448
Random value #8: -1944603219
Random value #9: 1952318979
Random value #10: 1012424606## Platform
The code was implemented specifically for an Espressif ESP32-C3 microcontroller on a Seeed Studio XIAO ESP32C3 Module [Link](https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html?srsltid=AfmBOoo0va9xPKzG-zCuRxoFXjVCC8uy9bMNLPEuQdSVxHsAHfRzhXAA)Esptool indicates ESP32-C3 (QFN32) (revision v0.4)
Quad Flat No-lead 32 pins (QFN32).
MicroPython v1.22.2 on 2024-02-22; ESP32C3 module with ESP32C3
## Performance
Time taken to generate xxxxxx values: **xx** seconds (avg)
Throughput: **xxxxxx** bytes/sec
**xxxxx** random values / sec.
Time taken to generate 8000 values: 837 seconds
Throughput: 38.23 bytes/sec
Number of random values per second: 9.56
Needless to say, it is rather slow !
Clearly, the adoption of HP SRAM on the C6 has greatly improved things compared to the SRAM on the C3 in terme of latency.## Ent Test Report
([www.fourmilab.ch](https://www.fourmilab.ch/random/)) John Walker
- Sample size: **xx MB**
- Total generated: **xxxxxx** valuesMy first attempt to generate random values gives on 44446 numbers, an entropy of **3.555333** bits per byte. although the MCU is slow, it fulfills its task perfectly.
## Dieharder Test Report
(https://webhome.phy.duke.edu/~rgb/General/dieharder.php) Robert G. Brown
Sample size: **xx MB**
Total generated: **xxxxxxx** values