Hardware random number generator explained

In computing, a hardware random number generator (HRNG), true random number generator (TRNG), non-deterministic random bit generator (NRBG), or physical random number generator is a device that generates random numbers from a physical process capable of producing entropy (in other words, the device always has access to a physical entropy source), unlike the pseudorandom number generator (PRNG, a.k.a. "deterministic random bit generator", DRBG) that utilizes a deterministic algorithm and non-physical nondeterministic random bit generators that do not include hardware dedicated to generation of entropy.

Many natural phenomena generate low-level, statistically random "noise" signals, including thermal and shot noise, jitter and metastability of electronic circuits, Brownian motion, atmospheric noise. Researchers also used the photoelectric effect, involving a beam splitter, other quantum phenomena,[1] [2] [3] and even the nuclear decay (due to practical considerations the latter, as well as the atmospheric noise, is not viable). While "classical" (non-quantum) phenomena are not truly random, an unpredictable physical system is usually acceptable as a source of randomness, so the qualifiers "true" and "physical" are used interchangeably.

A hardware random number generator is expected to output near-perfect random numbers ("full entropy"). A physical process usually does not have this property, and a practical TRNG typically includes a few blocks:

Hardware random number generators generally produce only a limited number of random bits per second. In order to increase the available output data rate, they are often used to generate the "seed" for a faster PRNG. DRBG also helps with the noise source "anonymization" (whitening out the noise source identifying characteristics) and entropy extraction. With a proper DRBG algorithm selected (cryptographically secure pseudorandom number generator, CSPRNG), the combination can satisfy the requirements of Federal Information Processing Standards and Common Criteria standards.

Uses

See also: Applications of randomness. Hardware random number generators can be used in any application that needs randomness. However, in many scientific applications additional cost and complexity of a TRNG (when compared with pseudo random number generators) provide no meaningful benefits. TRNGs have additional drawbacks for data science and statistical applications: impossibility to re-run a series of numbers unless they are stored, reliance on an analog physical entity can obscure the failure of the source. The TRNGs therefore are primarily used in the applications where their unpredictability and the impossibility to re-run the sequence of numbers are crucial to the success of the implementation: in cryptography and gambling machines.

Cryptography

The major use for hardware random number generators is in the field of data encryption, for example to create random cryptographic keys and nonces needed to encrypt and sign data. In addition to randomness, there are at least two additional requirements imposed by the cryptographic applications:

  1. forward secrecy guarantees that the knowledge of the past output and internal state of the device should not enable the attacker to predict future data;
  2. backward secrecy protects the "opposite direction": knowledge of the output and internal state in the future should not divulge the preceding data.

A typical way to fulfill these requirements is to use a TRNG to seed a cryptographically secure pseudorandom number generator.

History

Physical devices were used to generate random numbers for thousands of years, primarily for gambling. Dice in particular have been known for more than 5000 years (found on locations in modern Iraq and Iran), and flipping a coin (thus producing a random bit) dates at least to the times of ancient Rome.

The first documented use of a physical random number generator for scientific purposes was by Francis Galton (1890).[4] He devised a way to sample a probability distribution using a common gambling dice. In addition to the top digit, Galton also looked at the face of a dice closest to him, thus creating 6*4 = 24 outcomes (about 4.6 bits of randomness).

Kendall and Babington-Smith (1938)[5] used a fast-rotating 10-sector disk that was illuminated by periodic bursts of light. The sampling was done by a human who wrote the number under the light beam onto a pad. The device was utilized to produce a 100,000-digit random number table (at the time such tables were used for statistical experiments, like PRNG nowadays).

On 29 April 1947, the RAND Corporation began generating random digits with an "electronic roulette wheel", consisting of a random frequency pulse source of about 100,000 pulses per second gated once per second with a constant frequency pulse and fed into a five-bit binary counter. Douglas Aircraft built the equipment, implementing Cecil Hasting's suggestion (RAND P-113)[6] for a noise source (most likely the well known behavior of the 6D4 miniature gas thyratron tube, when placed in a magnetic field). Twenty of the 32 possible counter values were mapped onto the 10 decimal digits and the other 12 counter values were discarded.[7] The results of a long run from the RAND machine, filtered and tested, were converted into a table, which originally existed only as a deck of punched cards, but was later published in 1955 as a book, 50 rows of 50 digits on each page (A Million Random Digits with 100,000 Normal Deviates). The RAND table was a significant breakthrough in delivering random numbers because such a large and carefully prepared table had never before been available. It has been a useful source for simulations, modeling, and for deriving the arbitrary constants in cryptographic algorithms to demonstrate that the constants had not been selected maliciously ("nothing up my sleeve numbers"). [8]

Since the early 1950s, research into TRNGs has been highly active, with thousands of research works published and about 2000 patents granted by 2017.

Physical phenomena with random properties

A lot of different TRNG designs were proposed over time with a large variety of noise sources and digitization techniques ("harvesting"). However, practical considerations (size, power, cost, performance, robustness) dictate the following desirable traits:

Stipčević & Koç in 2014 classified the physical phenomena used to implement TRNG into four groups:

Electrical noise-based RNG

Noise-based RNGs generally follow the same outline: the source of a noise generator is fed into a comparator. If the voltage is above threshold, the comparator output is 1, otherwise 0. The random bit value is latched using a flip-flop. Sources of noise vary and include:

The drawbacks of using noise sources for an RNG design are:

Chaos-based RNG

The idea of chaos-based noise stems from the use of a complex system that is hard to characterize by observing its behavior over time. For example, lasers can be put into (undesirable in other applications) chaos mode with chaotically fluctuating power, with power detected using a photodiode and sampled by a comparator. The design can be quite small, as all photonics elements can be integrated on-chip. Stipčević & Koç characterize this technique as "most objectionable", mostly due to the fact that chaotic behavior is usually controlled by a differential equation and no new randomness is introduced, thus there is a possibility of the chaos-based TRNG producing a limited subset of possible output strings.

Free-running oscillators-based RNG

The TRNGs based on a free-running oscillator (FRO) typically utilize one or more ring oscillators (ROs), outputs of which are sampled using yet another oscillator. Since inverters forming the RO can be thought of as amplifiers with a very large gain, an FRO output exhibits very fast oscillations in phase in frequency domains. The FRO-based TRNGs are very popular due to their use of the standard digital logic despite issues with randomness proofs and chip-to-chip variability.

Quantum-based RNG

Quantum random number generation technology is well established with 8 commercial quantum random number generator (QRNG) products offered before 2017.

Herrero-Collantes & Garcia-Escartin list the following stochastic processes as "quantum":

To reduce costs and increase robustness of quantum random number generators,[9] online services have been implemented.

Performance test

The failure of a TRNG can be quite complex and subtle, necessitating validation of not just the results (the output bit stream), but of the unpredictability of the entropy source. Hardware random number generators should be constantly monitored for proper operation to protect against the entropy source degradation due to natural causes and deliberate attacks. FIPS Pub 140-2 and NIST Special Publication 800-90B define tests which can be used for this.

The minimal set of real-time tests mandated by the certification bodies is not large; for example, NIST in SP 800-90B requires just two continuous health tests:

  1. repetition count test checks that the sequences of identical digits are not too long, for a (typical) case of a TRNG that digitizes one bit at a time, this means not having long strings of either 0s or 1s;
  2. adaptive proportion test verifies that any random digit does not occur too frequently in the data stream (low bias). For bit-oriented entropy sources that means that the count of 1s and 0s in the bit stream is approximately the same.

Problems

It is very easy to misconstruct hardware or software devices which attempt to generate random numbers. Also, most 'break' silently, often producing decreasingly random numbers as they degrade. Failure modes in such devices are plentiful and are complicated, slow, and hard to detect. Methods that combine multiple sources of entropy are more robust.

Because many entropy sources are often quite fragile, and fail silently, statistical tests on their output should be performed continuously. Many, but not all, such devices incorporate some such tests into the software that reads the device.

Attacks

See main article: Random number generator attack. Just as with other components of a cryptography system, a cryptographic random number generator should be designed to resist certain attacks. Defending against these attacks is difficult without a hardware entropy source.

The physical processes in HRNG introduce new attack surfaces. For example, a free-running oscillator-based TRNG can be attacked using a frequency injection.[10]

Estimating entropy

See also: Entropy estimation.

There are mathematical techniques for estimating the entropy of a sequence of symbols. None are so reliable that their estimates can be fully relied upon; there are always assumptions which may be very difficult to confirm. These are useful for determining if there is enough entropy in a seed pool, for example, but they cannot, in general, distinguish between a true random source and a pseudorandom generator. This problem is avoided by the conservative use of hardware entropy sources.

See also

Sources

General references

External links

Notes and References

  1. Jacak . Marcin M. . Jóźwiak . Piotr . Niemczuk . Jakub . Jacak . Janusz E. . Quantum generators of random numbers . . 2021 . 11 . 1 . 16108 . 10.1038/s41598-021-95388-7 . 34373502 . 8352985 . free. 2021NatSR..1116108J .
  2. Ma . Xiongfeng . Yuan . Xiao . Cao . Zhu . Qi . Bing . Zhang . Zhen . Quantum random number generation . . 2016 . 2 . 1 . 16021 . 10.1038/npjqi.2016.21 . free. 1510.08957 . 2016npjQI...216021M .
  3. Book: Kollmitzer . Christian . Petscharnig . Stefan . Suda . Martin . Mehic . Miralem . Quantum Random Number Generation: Theory and Practice . 2020 . . 978-3-319-72596-3 . 11–34 . en . Quantum Random Number Generation.
  4. Galton . Francis . Dice for statistical experiments . Nature . 1890 . 42 . 1070 . 13–14 . 14 May 2014 . 10.1038/042013a0 . 1890Natur..42...13G . 4038609 . free . 4 March 2016 . https://web.archive.org/web/20160304000756/http://galton.org/essays/1890-1899/galton-1890-dice.pdf . live .
  5. Kendall, M. G., and B. Babington-Smith. 1938. “Randomness and other random sampling numbers”. Journal of the Royal Statistical Society 101:147–166.
  6. .
  7. .
  8. Book: Schneier . Bruce . Applied Cryptography . John Wiley & Sons, Inc. . 978-0-471-11709-4 . 423 . Second . Other Stream Ciphers and Real Random-Sequence Generators . 1995-11-01 .
  9. Huang . Leilei . Zhou . Hongyi . Feng . Kai . Xie . Chongjin . Quantum random number cloud platform . npj Quantum Information . Springer Science and Business Media LLC . 7 . 1 . 2021-07-07 . 2056-6387 . 10.1038/s41534-021-00442-x . 107. free . 2021npjQI...7..107H .
  10. Book: Markettos . A. Theodore . Moore . Simon W. . Lecture Notes in Computer Science . The Frequency Injection Attack on Ring-Oscillator-Based True Random Number Generators . Springer Berlin Heidelberg . Berlin, Heidelberg . 2009 . 978-3-642-04137-2 . 0302-9743 . 10.1007/978-3-642-04138-9_23 . 317–331 .