• 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

This Article Has Been Shared 834 Times!

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

  • How to Invert Signal for Arduino (HIGH to LOW or the Reverse)

    Such need is common when then need interfacing for IoT with household gadgets. Here is How to Invert Signal for Arduino (HIGH to LOW or the Reverse).

  • CircuitPython vs C/C++ vs Lua for the Microcontrollers

    Which Programming Language Better for the Microcontrollers to Invest Time? Here is CircuitPython vs C/C++ vs Lua Comparison for the Microcontrollers.

  • ESP32 Arduino IBM Watson IoT Pulse Sensor Amped

    Here is Simple ESP32 Arduino IBM Watson IoT Pulse Monitor With Easy Coding and Default Graphing Widgets of IBM Watson IoT. It is usable for testing purpose.

  • Control Multiple AC Appliances With One ESP32 Arduino

    Here is how to use ESP32 and IBM Watson IoT to control multiple relays (i.e. multiple AC appliances) by pushbutton and over the internet.

  • Connect ESP32 Arduino With a Samsung Smart Watch

    We can create an ESP32 Web Server, connect & control LED from watch browser. Here is How to Connect ESP32 Arduino With Samsung Smart Watch.

Additionally, 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

  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023
  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023

About This Article

Cite this article as: Abhishek Ghosh, "ESP32 as Hardware Random Number Generator," in The Customize Windows, May 27, 2020, January 31, 2023, https://thecustomizewindows.com/2020/05/esp32-as-hardware-random-number-generator/.

Source:The Customize Windows, JiMA.in

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT