Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/microcontroleurmonde/esp8266_rng

Tinny random number generate running on ESP8266. Just as proof of concept ^_^
https://github.com/microcontroleurmonde/esp8266_rng

esp8266 micropython rng

Last synced: about 5 hours ago
JSON representation

Tinny random number generate running on ESP8266. Just as proof of concept ^_^

Awesome Lists containing this project

README

        

# ESP8266_RNG
![Link](https://github.com/MicroControleurMonde/ESP32_RNG/blob/main/Reports/ESP32download.jpg)

Tinny random number generator running on ESP8266.

## Introduction:
In the spirit of the RP2040 generator [Link](https://github.com/MicroControleurMonde/RP2040-RNG), the code has been adapted to run on ESP8266EX.

***`Just as proof of concept`.***
## Concept:

A Micro-python library which provides an interface to generate a random number using the ESP8266's capabilities.

It enables Wi-Fi temporarily to enhance entropic noise, reads a random value from the ADC, and then disables Wi-Fi.

- Library : **esp8266_rng_lib**
- Libarary test: **Test_Simple_ESP8266_rng_lib.py**
- Example (100'000 values): **esp8266_100000.py**

The random number generated by the library is **64 bits**.

## Performance:

- Elapsed Time to generate 100000 values: 14 minutes and 11 secondes (**851  sec.**)
- Throughput: **942 Bytes/sec**
- **117** random values / sec.

## RNG testing

For verification purposes, we will only run Ent tests to quantify and assess the quality of the numbers generated.

### Ent Test

[Ent](https://www.fourmilab.ch) John Walker

- Sample size: 1.94 MB (in the Ent Folder)
- Total generated: 100'000 values
- [Ent report - Raw](https://github.com/MicroControleurMonde/ESP8266_RNG/blob/main/Ent/esp8266_100000_ent.txt)

### Ent/DJent Analysis :

- **Entropy**:
- Min Entropy (by max occurrence of symbol 1) = 0.978254
- Shannon IID Entropy = **0.999834** bits per symbol
- **Compression**: Optimal compression: it could reduce the file size by only 0.016638 %.
- **Distribution**: The distribution of values is broadly uniform, but the entropy and Pi calculations show that there are still biases in the data.
- **Monte Carlo**: The calculated value of Pi is 3.100761, with an error of 1.30%.
- **Correlation**: The serial correlation is -0.000466, which suggests that the successive symbols in the file are practically uncorrelated, therefore close to random.

## Conclusion:
So, overall the generator produces random numbers with good quality, but there are biases.

On the downside, the generator is extremely slow ... which is normal for this kind of small MCU.