• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » ESP32 as Hardware Random Number Generator

By Abhishek Ghosh May 27, 2020 9:02 am Updated on May 27, 2020

ESP32 as Hardware Random Number Generator

Advertisement

The capability of the ESP32 to generate truly random numbers is important for cryptographic operations. A random number generator generates a sequence of random numbers. A hardware random number generator is also known as a true random number generator. It generates random numbers from some physical process, not from code. A fundamental distinction is made between non-deterministic and deterministic random number generators. Since the implementation of a software procedure is usually deterministic, an external (e.g. physical) operation must be included to realize a non-deterministic random number generator. Pulse fluctuations of electronic circuits such as thermal noise of resistance or radioactive decay processes are exploited in the hardware random number generators. In general, all-natural sources based on physical effects that provide a fairly high quality can be used, but also other asynchronous sources. Some of the examples include atmospheric noise (such as analogue radio that is not tuned to a station), Photographic CCD sensor noise in a dark room, voltage fluctuations on a Z-diode. A hardware random number generator often has a transducer to convert the physical phenomena to an electrical signal. An amplifier increases the amplitude of the random fluctuations making it measurable. An analogue-to-digital converter can convert it into a binary digit.

In practice, software random number generators are often used in a mixed form with hardware random number generators. They are called hybrid random number generators and Linux or BSD are good examples of such deployment.

Table of Contents

  • 1 Introduction
  • 2 Uses of HRNG
  • 3 Drawbacks
  • 4 HRNG in ESP32
  • 5 Example Code

 

Uses of Hardware Random Number Generators

 

Advertisement

---

Dices have are mostly used in gambling to randomize the events in a game. One main use-case of the hardware random number generators is in data encryption, like for creating cryptographic keys to encrypt and sign. Hardware random number generators produce sequences of numbers technically difficult to be predictable provide greater security.

Unpredictable numbers were first used in gambling, slot machines and roulette wheels. In these use-cases, random number generation is regulated by governmental gaming commissions. Once, even the best online slots machines used to suffer from cheaters a lot before technology got more advanced, and now there are minimal ways in which a user can cheat the system. Good physical methods for generating random numbers are also the dice and drawing of lottery numbers with the typical machines. Random draws in relatively fast succession were realized in electromechanical gambling machines, based on cam discs with eccentric wheel and a switching time variator.

 

Drawbacks of the Hardware Random Number Generators

 

The physical random number generators are not fast since independence and equal distribution of the generated random numbers can only be achieved by sufficiently large distances in the observation of the physical processes or intercept methods. However, this is only a question of the technology used, because random processes such as thermal noise have limit frequencies of many terahertz.

There are other physical issues. Such as, Geiger-Müller counter tubes typically have a lifespan of one trillion pulses and are also dependent on temperature, magnetic fields and supply voltage. Also, for Geiger counters, the pulse rate must be significantly higher than the clock frequency at which the pulses are read. One solution to this problem is to use many random number generators in one unit. According to the central limit set of statistics, you get perfectly random bits even with bad random number generators (provided there are enough random number generators used).

 

Hardware Random Number Generator in ESP32

 

The ESP32 system-on-chip includes a True Random Number Generator as a peripheral. The random number generation is based on the noise of it’s WiFi or Bluetooth RF subsystem. This means, when the Bluetooth and WiFi are disabled, the ESP32 falls back to the software-based pseudorandom number generation. The Random Number Generator with the WiFi-enabled known to be passed the Dieharder Random Number Test suite. The communication between a CPU and internal peripherals is through the registers, which is nothing but specific memory addresses. The random number generator stores the produced number in a register named RNG_DATA_REG, located at address 0x3FF75144. The ESP32’s true random number generator can write a 32-bit value to the RNG_DATA_REG register.

 

Using the Hardware Random Number Generator of ESP32 from Arduino IDE

 

Official Arduino software has a function named random(), which generates pseudo-numbers. This is a lower level function. The official Arduino library for ESP32 supports esp_random() function which is the way to get the true random number from the RNG_DATA_REG register. The associated file can be found here on GitHub (Line number 138).

The software and hardware of random number generation can be tested with a small sketch for the ESP32 :
ESP32 as Hardware Random Number Generator

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void setup()
{
Serial.begin(115200);
}
void loop()
{
Serial.println("-----------");
// Official ESP32 function
Serial.println(esp_random());
// Official Arduino function
Serial.println(random(1,100));
delay(1000);
}

Tagged With esp32 signal generator , esp32 rng , esp32 true rng , www how arduino randomize true random number com
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to ESP32 as Hardware Random Number Generator

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • How to Control Multiple Relays With Single Arduino ESP32?

    Before How to Control Multiple Relays With Single Arduino ESP32 Testing, You Need to Learn How to Create Multiple MQTT Channels & Fetch Data.

  • Detect Smartwatch With ESP32 on IBM Watson IoT Widget

    In our previous guide, we have shown that we can trigger ESP32 (with Arduino IDE) to send message to IBM Watson IoT in Presence of a Particular Samsung Galaxy Smartwatch. That process involves BLE and WiFi. In our one series of articles on Samsung Smartwatch as Proximity Switch, we triggered a local event, such as […]

  • WROOM ESP32 Example Codes For IBM Watson IoT Platform

    Here Are Few WROOM ESP32 Example Codes For IBM Watson IoT Platform So That Anyone Can Get Started With Both of Them Without Huge Experience.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy