All Topics  
Hardware random number generator

 

   Email Print
   Bookmark   Link






 

Hardware random number generator



 
 
In computing
Computing

Computing is usually defined as the activity of using and developing computer technology, computer hardware and computer software. It is the computer-specific part of information technology....
, a hardware random number generator is an apparatus that generates random number
Random number

Random number may refer to:* A number generated for or part of a set exhibiting statistical randomness.* A random sequence obtained from a stochastic process....
s from a physical process. Such devices are often based on microscopic phenomena such as thermal noise or the photoelectric effect
Photoelectric effect

The photoelectric effect is a phenomenon in which electrons are emitted from matter after the absorption of energy from electromagnetic wave such as x-rays or visible light....
 or other quantum
Quantum

In physics, a quantum is an indivisible entity of a quantity that has the same units as the Planck constant and is related to both energy and momentum of elementary particles of matter and of photons and other bosons....
 phenomena. These processes are, in theory, completely unpredictable, and the theory's assertions of unpredictability are subject to experimental test. A quantum-based hardware random number generator typically contains an amplifier
Amplifier

Generally, an amplifier or simply amp, is any machine that changes, usually increases, the amplitude of a Signal . The "signal" is usually voltage or current....
 to bring the output of the physical process into the macroscopic
Macroscopic

Macroscopic is a word commonly used to describe physics objects that are measurement and observation by the naked eye. When applied to phenomena and abstract objects, it describes existence in the world as we perceive it....
 realm, and a transducer
Transducer

A transducer is a device, usually electricity, electronics, electro-mechanical, electromagnetic, photonic, or photovoltaic that converts one type of energy or physical attribute to another for various purposes including measurement or information transfer ....
 to convert the output into a digital signal.

Random number generators can also be built from macroscopic phenomena, such as playing cards, dice
Dice

A die is a small polyhedron object, usually cubic, used for generating Statistical randomnesss or other symbols. This makes dice suitable as gambling devices, especially for craps or sic bo, or for use in non-gambling tabletop games....
, roulette
Roulette

Roulette is a casino and gambling game named after the French language word meaning "small wheel". In the game, players may choose to place bets on either a number, a range of numbers, the color red or black, or whether the number is odd or even....
 wheels and lottery machine
Lottery machine

A lottery machine is the machine used to draw the winning numbers for a lottery.Early lotteries were done by drawing numbers, or winning tickets, from a container....
s.






Discussion
Ask a question about 'Hardware random number generator'
Start a new discussion about 'Hardware random number generator'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In computing
Computing

Computing is usually defined as the activity of using and developing computer technology, computer hardware and computer software. It is the computer-specific part of information technology....
, a hardware random number generator is an apparatus that generates random number
Random number

Random number may refer to:* A number generated for or part of a set exhibiting statistical randomness.* A random sequence obtained from a stochastic process....
s from a physical process. Such devices are often based on microscopic phenomena such as thermal noise or the photoelectric effect
Photoelectric effect

The photoelectric effect is a phenomenon in which electrons are emitted from matter after the absorption of energy from electromagnetic wave such as x-rays or visible light....
 or other quantum
Quantum

In physics, a quantum is an indivisible entity of a quantity that has the same units as the Planck constant and is related to both energy and momentum of elementary particles of matter and of photons and other bosons....
 phenomena. These processes are, in theory, completely unpredictable, and the theory's assertions of unpredictability are subject to experimental test. A quantum-based hardware random number generator typically contains an amplifier
Amplifier

Generally, an amplifier or simply amp, is any machine that changes, usually increases, the amplitude of a Signal . The "signal" is usually voltage or current....
 to bring the output of the physical process into the macroscopic
Macroscopic

Macroscopic is a word commonly used to describe physics objects that are measurement and observation by the naked eye. When applied to phenomena and abstract objects, it describes existence in the world as we perceive it....
 realm, and a transducer
Transducer

A transducer is a device, usually electricity, electronics, electro-mechanical, electromagnetic, photonic, or photovoltaic that converts one type of energy or physical attribute to another for various purposes including measurement or information transfer ....
 to convert the output into a digital signal.

Random number generators can also be built from macroscopic phenomena, such as playing cards, dice
Dice

A die is a small polyhedron object, usually cubic, used for generating Statistical randomnesss or other symbols. This makes dice suitable as gambling devices, especially for craps or sic bo, or for use in non-gambling tabletop games....
, roulette
Roulette

Roulette is a casino and gambling game named after the French language word meaning "small wheel". In the game, players may choose to place bets on either a number, a range of numbers, the color red or black, or whether the number is odd or even....
 wheels and lottery machine
Lottery machine

A lottery machine is the machine used to draw the winning numbers for a lottery.Early lotteries were done by drawing numbers, or winning tickets, from a container....
s. The presence of unpredictability in these phenomena can be justified by the theory of unstable dynamical system
Dynamical system

The dynamical system concept is a mathematics formalization for any fixed "rule" which describes the time dependence of a point's position in its ambient space....
s and chaos theory
Chaos theory

In mathematics, chaos theory describes the behavior of certain dynamical system s ? that is, systems whose states evolve with time ? that may exhibit dynamics that are highly sensitive to initial conditions ....
. These theories suggest that even though macroscopic phenomena are deterministic in theory under Newtonian mechanics, real-world systems evolve in ways that cannot be predicted in practice because one would need to know the micro-details of initial conditions and subsequent manipulation or change.

Although dice have been mostly used in gambling
Gambling

Gambling is the wikt:wager#Verb of money or something of material Value on an event with an uncertain outcome with the primary intent of winning additional money and/or material goods....
, and in recent times as 'randomizing' elements in games (e.g. role playing games), the Victorian
Victorian era

The Victorian Era of the United Kingdom of Great Britain and Ireland was the period of Victoria of the United Kingdom reign from June 1837 to January 1901....
 scientist Francis Galton
Francis Galton

Sir Francis Galton Fellow of the Royal Society , Cousin#Half_cousins of Charles Darwin, was an England Victorian era polymath, anthropologist, Eugenics, tropical List of explorers, geographer, inventor, meteorologist, proto-geneticist, Psychometrics, and statistician....
 described a way to use dice to explicitly generate random numbers for scientific purposes, in 1890. Though some gamblers believe they can control their throws of dice enough to win at dice games (a claim which has been long debated), with a method such as the one demonstrated in Episode 4, Series 3 of the UK TV series "The Real Hustle
The Real Hustle

The Real Hustle is a BBC television series made by Objective Productions and written by Alex Conran and R. Paul Wilson. The show demonstrates confidence trick and Magic tricks, distraction scams and proposition bets performed on members of the public by presenters Conran, Wilson and Jessica-Jane Clement ....
", no one has produced a way to exploit the claimed effect in either generating or attacking physical randomness sources.

Hardware random number generators are often relatively slow, and they may produce a biased sequence (i.e., some values are more common than others). Whether a hardware random number generator is suitable for a particular application depends on the details of both the application and the generator.

Pseudo-random number generators


Most computer "random number generators" are not hardware devices, but are software routines implementing generator algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
s. They are often supplied as library routines in programming language
Programming language

A programming language is a machine-readable artificial language designed to express computations that can be performed by a machine, particularly a computer....
 implementations, or as part of the operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
. These are more properly called pseudo-random number generators, since, being finite state machine
Finite state machine

A finite state machine or finite state automaton or simply a state machine, is a model of behavior composed of a finite number of state s, transitions between those states, and actions....
s, they cannot produce truly random outputs. Within that limitation, most produce sequences which pass one or more statistical pattern tests for randomness. Although the primary reason for using such pseudo-random number generators is typically cost and convenience, avoiding the need for specialized – often expensive – supporting hardware, pseudo-random number generators also have the property that random number series can be "replayed" which may be useful when testing applications or as a means of standardizing random number generators, for example in a networked game which relies upon random numbers which must be generated on both machines during the application.

Algorithmic information theory
Algorithmic information theory

Algorithmic information theory is a subfield of information theory and computer science that concerns itself with the relationship between theory of computation and Information#Measuring information....
 defines a sequence of bit
Bit

A bit is a binary numeral system numerical digit, taking a value of either 0 or 1. Binary digits are a basic unit of information Computer data storage and transmission in digital computing and digital information theory....
s as non-random if it can be produced by some computer program that is shorter than that sequence (Chaitin-Kolmogorov randomness). Pseudo-random number generators' outputs are decidedly non-random by that test: they can usually be programmed in a few thousand bits, but can produce far larger sequences, with periods so long no currently plausible computer or combination of them could exhaust a single period before the heat death of the Universe.

There are several informal definitions of randomness
Randomness

Randomness is a lack of order, purpose, Causality, or predictability. Randomness as defined by Aristotle is the situation, when a choice is to be made which has no logical component by which to determine or make the choice ....
, usually based on either a lack of discernible pattern
Pattern

A pattern, from the French language patron, is a type of theme of recurring events of or objects, sometimes referred to as elements of a set....
s in a sequence, or the unpredictability of the sequence or various aspects of it by, generally, the most puissant possible adversary. Output from well-designed pseudo-random number generators should pass assorted statistical tests probing for non-randomness (see NIST Special Publication 800-22, Knuth
Donald Knuth

Donald Ervin Knuth is a renowned computer science and Emeritus of the Art of Computer Programming at Stanford University.Author of the seminal multi-volume work The Art of Computer Programming , Knuth has been called the "father" of the run-time analysis, contributing to the development of, and systematizing formal mathematical techn...
, The Art of Computer Programming
The Art of Computer Programming

The Art of Computer Programming is a comprehensive monograph written by Donald Knuth that covers many kinds of programming algorithms and their analysis....
,
vol. 2, and RFC 4086 for details of many such tests).

The sequences generated by pseudo-random number generators always have some fixed period, since any pseudo-random number generator implemented in software forms a finite state machine generating an infinite series. Consequently the period of any pseudo-random number generator is the smallest cycle in the state diagram. Given an original state of the generator and the implementation of the algorithm, a pseudo-random number generator of this sort is totally predictable. Often even partial knowledge of the initial state of the generator can be sufficient to determine the random number sequence. On the other hand, it has become relatively easy to produce pseudo-random number generators that are guaranteed not to repeat on any currently plausible computer within a time-frame that is millions of times longer than the age of the universe
Age of the universe

The age of the universe is the time elapsed between the Big Bang and the present day. Current theory and observations suggest that this is between 13.61 and 13.85 1000000000 years....
. It is an open question whether it is always possible in practice to distinguish the output of such a pseudo-random number generator from that of a perfectly random source without knowledge of the generator's internal state.

A central analytic approach in modern cryptography rests on the assumption that testing cipher
Cipher

In cryptography, a cipher is an algorithm for performing encryption and decryption — a series of well-defined steps that can be followed as a procedure....
 output can be distinguished from random noise without knowledge of the key
Key (cryptography)

In cryptography, a key is a piece of information that determines the functional output of a cryptographic algorithm or cipher. Without a key, the algorithm would have no result....
 used by the algorithm to generate the ciphertext output. In addition, there are several contingent proofs of security for some cryptographic schemes which depend on the randomness of an input value or constants used within an algorithm.

Uses


Unpredictable random numbers were first investigated in the context of gambling
Gambling

Gambling is the wikt:wager#Verb of money or something of material Value on an event with an uncertain outcome with the primary intent of winning additional money and/or material goods....
, and many randomizing devices such as dice
Dice

A die is a small polyhedron object, usually cubic, used for generating Statistical randomnesss or other symbols. This makes dice suitable as gambling devices, especially for craps or sic bo, or for use in non-gambling tabletop games....
, shuffling playing cards, and roulette
Roulette

Roulette is a casino and gambling game named after the French language word meaning "small wheel". In the game, players may choose to place bets on either a number, a range of numbers, the color red or black, or whether the number is odd or even....
 wheels, were first developed for use in gambling. Fairly produced random numbers are vital to electronic gambling and ways of creating them are sometimes regulated by governmental gaming commissions.

Random numbers are also used for non-gambling purposes, both where their use is mathematically important, such as sampling for opinion poll
Opinion poll

An opinion poll is a statistical survey of public opinion from a particular sampling . Opinion polls are usually designed to represent the opinions of a population by conducting a series of questions and then extrapolating generalities in ratio or within confidence intervals....
s, and in situations where fairness is approximated by randomization
Randomization

Randomization is the process of making something random; this means:* Generating a random permutation of a sequence .* Selecting a random sample of a population ....
, such as selecting jurors and military draft lotteries
Selective Service Act

Selective Service Act may refer to:*Selective Service Act of 1917, or Selective Draft Act, which was passed by the Congress of the United States on May 18, 1917...
. Their use is also evident in ancient writings, for example in the Book of Numbers
Book of Numbers

The Book of Numbers, , is the fourth book of the Torah, the Tanakh, and the Old Testament. In the Greek language Septuagint it is called Arithmoi, or Numbers....
 (33:54), Moses
Moses

Moses is a Hebrew Bible Hebrews religious leader, lawgiver, prophet, to whom the Mosaic authorship of the Torah is traditionally attributed. Also called Moshe Rabbeinu in Hebrew , he is the most important prophet in Judaism, and also an important prophet of Christianity, Islam, the Bah?'? Faith, Rastafari movement, Chrislam and many ot...
 commands the Israelites to apportion the land by lot (). And the drawing of lots, often pottery shards, are well attested in the Classical world of Greece and Rome. Some of these very shards have been archeologically recovered.

Random numbers are used in both symmetric and asymmetric cryptography
Cryptography

Cryptography is the practice and study of hiding information. In modern times cryptography is considered a branch of both mathematics and computer science and is affiliated closely with information theory, computer security and engineering....
 as a way of generating keys and for the random values used in the operation of some algorithms. Since integrity of the communication between the two parties is conditional on the continued secrecy of these keys, using a random number generator which does not have adequate randomness may be expected to compromise the security of messages.

Early attempts


One early way of producing random numbers was by a variation of the same machines used to play keno
Keno

Keno is a lottery-like or Bingo -like gambling game often played at modern casinos, and is also offered as a game in some state lotteries. A traditional live casino keno game uses a circular glass enclosure called a "bubble" containing 80 ping pong-like balls which determine the balldraw result....
 or select lottery
Lottery

A lottery is a form of gambling which involves the drawing of lots for a prize. Some governments outlaw it, while others endorse it to the extent of organizing a national lottery....
 numbers. Basically, these mixed numbered ping-pong balls with blown air, perhaps combined with mechanical agitation, and use some method to withdraw balls from the mixing chamber . This method gives reasonable results in some senses, but the random numbers generated by this means are expensive. The method is inherently slow, and is unusable in most automated situations, (i.e., with computers).

In the early 1950s the RAND Corporation built an "electronic roulette wheel" that generated random numbers using 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 5-bit binary counter. Twenty of the 32 possible counter values were mapped onto the 10 decimal digits and the other 12 counter values were discarded. This pioneering machine was one of the first electronic hardware random number generators.

The results of a long run from the RAND machine, carefully filtered and tested, were converted into a table, which was published in 1955 in the book A Million Random Digits with 100,000 Normal Deviates
A Million Random Digits with 100,000 Normal Deviates

A Million Random Digits with 100,000 Normal Deviates is a 1955 book by the RAND Corporation. The book of tables was an important 20th century work in the field of statistics and random numbers....
. 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 was useful for simulations and modeling. But, having been published, it is not usable as cryptographic keys, or for preparing them, or as a seed in a cryptographic pseudo-random number generator. However, since it was published long before modern cryptography, using values from it for the arbitrary constants used in some cryptographic algorithms would demonstrate that the constants had not been selected for (in B. Schneier
Bruce Schneier

Bruce Schneier is an American cryptographer, computer security specialist, and writer. He is the author of several books on computer security and cryptography, and is the founder and chief technology officer of BT Counterpane, formerly Counterpane Internet Security, Inc....
's words) "nefarious purpose(es)." Khufu and Khafre
Khufu and Khafre

In cryptography, Khufu and Khafre are two block ciphers designed by Ralph Merkle in 1989 while working at Xerox's Palo Alto Research Center....
 do this, for example (ref Applied Cryptography - B. Schneier). See: Nothing up my sleeve number
Nothing up my sleeve number

In cryptography, nothing up my sleeve numbers are any numbers which, by their construction, are above suspicion of hidden properties. They are used in creating cryptographic functions such as cryptographic hash and ciphers....
s.

Physical phenomena with quantum-random properties


There are two fundamental sources of practical quantum mechanical physical randomness: quantum mechanics at the atomic or sub-atomic level and thermal noise (some of which is quantum mechanical in origin). Quantum mechanics predicts that certain physical phenomena, such as the nuclear decay of atoms, are fundamentally random and cannot, in principle, be predicted. (For a discussion of empirical verification of quantum unpredictability, see Bell test experiments
Bell test experiments

The Bell test experiments serve to investigate the validity of the quantum entanglement effect in quantum mechanics by using some kind of Bell inequality....
.) And, because we live at a finite, non-zero temperature, every system has some random variation in its state; for instance, molecules of air are constantly bouncing off each other in a random way. (See statistical mechanics
Statistical mechanics

Statistical mechanics is the application of probability theory, which includes Mathematics tools for dealing with large populations, to the field of mechanics, which is concerned with the motion of particles or objects when subjected to a force....
.) This randomness is a quantum phenomenon as well. (See phonon
Phonon

In physics, a phonon is a quantum mode of vibration occurring in a rigid crystal structure, such as the atomic lattice of a solid. The study of phonons is an important part of solid state physics, because phonons play a major role in many of the physical properties of solids, including a material's thermal conductivity and electrical conduc...
.)

Because the outcome of quantum-mechanical events cannot in principle be predicted, they are the 'gold standard' for random number generation. Some quantum phenomena used for random number generation include:

  • Shot noise
    Shot noise

    Shot noise is a type of electronic noise that occurs when the finite number of particles that carry energy, such as electrons in an electronic circuit or photons in an optical device, is small enough to give rise to detectable statistical fluctuations in a measurement....
    , a quantum mechanical noise source in electronic circuits. A simple example is a lamp shining on a photodiode. Due to the uncertainty principle
    Uncertainty principle

    In quantum physics, the Werner Heisenberg uncertainty principle states that certain physical quantities, like the position and momentum, cannot both have precise values at the same time....
    , arriving photons create noise in the circuit. Collecting the noise for use poses some problems, but this is an especially simple random noise source.


  • A nuclear decay radiation source (as, for instance, from some kinds of commercial smoke detector
    Smoke detector

    A smoke detector is a device that detects smoke and issues a signal to a fire alarm system, or issues a local audible and/or visual alarm from the detector itself....
    s), detected by a Geiger counter
    Geiger counter

    A Geiger counter, also called a Geiger-M?ller counter, is a type of particle detector that measures ionizing radiation....
     attached to a PC.


  • Photon
    Photon

    In physics, the photon is an elementary particle, the quantum of the electromagnetic field and the basic unit of light and all other forms of electromagnetic radiation....
    s travelling through a semi-transparent mirror
    Beam splitter

    A beam splitter is an optical instrument that splits a beam of light in two. It is the crucial part of most Interferometrys.In its most common form, a cube, it is made from two triangular glass Prism s which are glued together at their base using Canada balsam....
    , as in the commercial product, Quantis from id Quantique
    Id Quantique

    id Quantique is a small company located in Geneva, Switzerland. It sells quantum key distribution systems, Photon counter, and Hardware random number generator....
    . The mutually exclusive events (reflection — transmission) are detected and associated to "0" or "1" bit values respectively.


Thermal phenomena are easier to detect. They are (somewhat) vulnerable to attack by lowering the temperature of the system, though most systems will stop operating at temperatures (e.g., ~150 K) low enough to reduce noise by a factor of two. Some of the thermal phenomena used include:

  • Thermal noise from a resistor
    Resistor

    |- align = "center"||width = "25"|| |- align = "center"||| Potentiometer|- align = "center"| || |- align = "top"| Resistor|| Variable resistor...
    , amplified to provide a random voltage source.


  • Avalanche noise
    Avalanche breakdown

    Avalanche breakdown is a phenomenon that can occur in both Electrical insulation and Semiconductor materials. It is a form of electric current multiplication that can allow very large currents to flow within materials which are otherwise good insulators....
     generated from an avalanche diode
    Avalanche diode

    An avalanche diode is a diode that is designed to go through avalanche breakdown at a specified reverse bias voltage and conduct as a type of voltage reference....
    , or Zener breakdown noise from a reverse-biased zener diode
    Zener diode

    A Zener diode is a type of diode that permits electric current in the forward direction like a normal diode, but also in the reverse direction if the voltage is larger than the breakdown voltage known as "Zener knee voltage" or "Zener voltage"....
    .


  • Atmospheric noise
    Noise (radio)

    Radio noise in radio reception is the superposition of white noise and other disturbing influences on the signal, caused either by thermal noise and other electronic noise from receiver input circuits or by interference from radiated electromagnetic noise picked up by the receiver's antenna ....
    , detected by a radio receiver attached to a PC (though much of it, such as lightning noise, is not properly thermal noise, but most likely a chaotic
    Chaos

    Chaos typically refers to unpredictability, and is the antithesis of cosmos.The word did not mean "disorder" in classical-period ancient Greece....
     phenomenon).


Another variable physical phenomenon that is easy to measure is clock drift
Clock drift

Clock drift refers to several related phenomena where a clock does not run at the exact right speed compared to another clock. That is, after some time the clock "drifts apart" from the other clock....
.

In the absence of quantum effects or thermal noise, other phenomena that tend to be random, although in ways not easily characterized by laws of physics, can be used. When several such sources are combined carefully (as in, for example, the Yarrow algorithm
Yarrow algorithm

The Yarrow algorithm is a cryptographically secure pseudorandom number generator. The name is taken from the yarrow plant, the stalks of which are dried and used as a randomising agent in I Ching divination....
 or Fortuna
Fortuna (PRNG)

Fortuna is a cryptographically secure pseudorandom number generator devised by Bruce Schneier and Niels Ferguson. It is named after Fortuna , the Roman goddess of chance....
 CSPRNG
Cryptographically secure pseudorandom number generator

A cryptographically secure pseudo-random number generator is a pseudo-random number generator with properties that make it suitable for use in cryptography....
s), enough entropy can be collected for the creation of cryptographic keys and nonces
Cryptographic nonce

In security engineering, a nonce stands for number used once . It is often a randomness or pseudo-random number issued in an authentication protocol to ensure that old communications cannot be reused in replay attacks....
, though generally at restricted rates. The advantage is that this approach needs, in principle, no special hardware. The disadvantage is that a sufficiently knowledgable attacker can surreptitiously modify the software or its inputs, thus reducing the randomness of the output, perhaps substantially. The primary source of randomness typically used in such approaches is the precise timing of the interrupt
Interrupt

In computing, an interrupt is an asynchronous communication signal from hardware indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
s caused by mechanical input/output devices, such as keyboards and disk drives, various system information counters, etc.

This last approach must be implemented carefully and may be subject to attack if it is not. For instance, the generator built into the Linux kernel, which combines several such sources, may be vulnerable to an attack . The random number generator used for cryptographic purposes in an early version of the Netscape
Netscape

Netscape Communications is a United States computer services company, best known for its web browser. The browser was once dominant in terms of Usage share of web browsers, but lost most of that share to Internet Explorer during the browser wars....
 browser was certainly vulnerable (and was promptly changed).

One approach in using physical randomness is to convert a noise source into a random bit sequence in a separate device that is then connected to the computer through an I/O port. The acquired noise signal is amplified, filtered, and then run through a high-speed voltage comparator to produce a logic signal that alternates states at random intervals. At least in part, the randomness produced depends on the specific details of the 'separate device'. Care must also always be taken when amplifying low-level noise to keep out spurious signals, such as power line hum and unwanted broadcast transmissions, and to avoid adding bias during acquisition and amplification. In some simple designs, the fluctuating logic value is converted to an RS-232
RS-232

In telecommunications, RS-232 is a standard for serial communications binary data signals connecting between a DTE and a DCE . It is commonly used in computer serial ports....
 type signal and presented to a computer's serial port. Software then sees this series of logic values as bursts of "line noise" characters on an I/O port. More sophisticated systems may format the bit values before passing them into a computer.

Another approach is to feed an analog noise signal to an analog to digital converter, such as the audio input port built into most personal computers. The digitized signal may then be processed further in software to remove bias. However, digitization is itself often a source of bias, sometimes subtle, so this approach requires considerable caution and care.

Some have suggested using digital cameras, such as webcam
Webcam

File:Logitech E2500 webcam.jpgWebcams are video capture connected to computer or computer network, often using Universal Serial Bus or, if they connect to networks, ethernet or Wi-Fi....
s, to photograph chaotic macroscopic phenomena. A group at Silicon Graphics
Silicon Graphics

Silicon Graphics, Inc. is a company manufacturer high-performance computing solutions, including computer hardware and computer software. SGI was founded by James H....
  imaged Lava lamp
Lava lamp

A lava lamp is a Novelties used for decoration rather than illumination; the slow chaos theory rise and fall of randomly-shaped blobs of wax is suggestive of lava, hence the name....
s to generate random numbers . One problem was determining whether the chaotic shapes generated were actually random – the team decided that they are in properly operating Lava lamps. Other chaotic scenes could be employed, such as the motion of streamers in a fan air stream or, probably, bubbles in a fish tank
Aquarium

An aquarium is a vivarium consisting of at least one transparent side in which water-dwelling plants or animals are kept. fishkeeping use aquaria to keep fish, invertebrates, amphibians, marine mammals, turtles, and aquatic plants....
 (fish optional). The digitized image will generally contain additional noise, perhaps not very random, resulting from the video to digital conversion process. A higher quality device might use two sources and eliminate signals that are common to both — depending on the sources and their physical locations, this reduces or eliminates interference from outside electric and magnetic fields. This is often recommended for gambling devices, to reduce cheating by requiring attackers to exploit bias in several "random bit" streams.

The Commodore 64
Commodore 64

The Commodore 64 is an 8-bit home computer released by Commodore International in August, 1982, at a price of United States dollar595. Preceded by the Commodore VIC-20 and Commodore MAX Machine, the C64 features 64 kilobytes of Random-access memory with sound and graphics performance that were superior to IBM-compatible computers of tha...
 provided a hardware random number generator based on its soundchip, the MOS Technology SID
MOS Technology SID

The MOS Technology 6581/8580 SID was the built-in Programmable Sound Generator chip of Commodore International's Commodore CBM-II, Commodore 64, Commodore 128 and Commodore MAX Machine home computers....
 6581. Random bytes can be fetched from memory address $D41B as long as the third oscillator's waveform is set to produce random noise.

Clock drift


There are several ways to measure and use clock drift
Clock drift

Clock drift refers to several related phenomena where a clock does not run at the exact right speed compared to another clock. That is, after some time the clock "drifts apart" from the other clock....
 as a source of randomness.

The Intel 80802 Firmware Hub chip included a hardware RNG using two free running oscillators, one fast and one slow. A thermal noise source (non-commonmode noise from two diodes) is used to modulate the frequency of the slow oscillator, which then triggers a measurement of the fast oscillator. That output is then debiased using a von Neumann
John von Neumann

John von Neumann was a Hungarian American mathematician who made major contributions to a vast range of fields, including set theory, functional analysis, quantum mechanics, ergodic theory, continuous geometry, economics and game theory, computer science, numerical analysis, hydrodynamics , and statistics, as well as many other mathematical...
 type decorrelation step (see below). The output rate of this device is somewhat less than 100,000 bit/s. This chip was an optional component of the 840 chipset family that supported an earlier Intel bus. It is not included in modern PCs.

All VIA C3
VIA C3

The VIA C3 is a family of x86 central processing units for personal computers designed by Centaur Technology and sold by VIA Technologies. The different CPU cores are built following the Centaur Technology#Design_methodology....
 microprocessors have included a hardware RNG on the processor chip since 2003. Instead of using thermal noise, raw bits are generated by using four freerunning oscillators which are designed to run at different rates. The output of two are XORed to control the bias on a third oscillator, whose output clocks the output of the fourth oscillator to produce the raw bit. Minor variations in temperature, silicon characteristics, and local electrical conditions cause continuing oscillator speed variations and thus produce the entropy of the raw bits. To further ensure randomness, there are actually two such RNGs on each chip, each positioned in different environments and rotated on the silicon. The final output is a mix of these two generators. The raw output rate is tens to hundreds of megabits per second, and the whitened rate is a few megabits per second. User software can access the generated random bit stream using new non-privileged machine language instructions.

A software implementation of a related idea on ordinary hardware is included in CryptoLib, a cryptographic routine library (JB Lacy, DP Mitchell, WM Schell, CryptoLib: Cryptography in software, Proc 4th USENIX Security Symp, pg 1-17, 1993). The algorithm is called truerand. Most modern computers have two crystal oscillators, one for the real-time clock and one for the primary CPU clock; truerand exploits this fact. It uses an operating system service that sets an alarm, running off the real-time clock. One subroutine sets that alarm to go off in one clock tick (usually 1/60th of a second). Another then enters a while loop waiting for the alarm to trigger. Since the alarm will not always trigger in exactly one tick, the least significant bits of a count of loop iterations, between setting the alarm and its trigger, will vary randomly, possibly enough for some uses. Truerand doesn't require additional hardware, but in a multi-tasking system great care must be taken to avoid non-randomizing interference from other processes (e.g., in the suspension of the counting loop process as the operating system scheduler starts and stops assorted processes).

Dealing with bias

The bit-stream from such systems is prone to be biased, with either 1s or 0s predominating. There are two approaches to dealing with bias and other artifacts. The first is to design the RNG to minimize bias inherent in the operation of the generator. One method to correct this feeds back the generated bit stream, filtered by a low-pass filter, to adjust the bias of the generator. By the central limit theorem
Central limit theorem

The central limit theorem states that the re-averaged sum of a sufficiently large number of Independent and identically-distributed random variables Statistical independence random variables each with finite mean and variance will be approximately normal distribution ....
, the feedback loop will tend to be well-adjusted 'almost all the time'. Ultra-high speed random number generators often use this method. Even then, the numbers generated are usually somewhat biased.

Software whitening

A second approach to coping with bias is to reduce it after generation (in software or hardware). Even if the above hardware bias reduction steps have been taken, the bit-stream should still be assumed to contain bias and correlation. There are several techniques for reducing bias and correlation, often known by the name "whitening
Decorrelation

Decorrelation is a general term for any process that is used to reduce autocorrelation within a signal, or cross-correlation within a set of signals, while preserving other aspects of the signal....
" algorithms, by analogy with the related problem of producing white noise from a correlated signal.

John von Neumann
John von Neumann

John von Neumann was a Hungarian American mathematician who made major contributions to a vast range of fields, including set theory, functional analysis, quantum mechanics, ergodic theory, continuous geometry, economics and game theory, computer science, numerical analysis, hydrodynamics , and statistics, as well as many other mathematical...
 invented a simple algorithm to fix simple bias, and reduce correlation. It considers bits two at a time, taking one of three actions: when two successive bits are equal, they are not used as a random bit; a sequence of 1,0 becomes a 1; and a sequence of 0,1 becomes a zero. This eliminates simple bias, and is easy to implement as a computer program or in digital logic. This technique works no matter how the bits have been generated. It cannot assure randomness in its output, however. What it can do (with significant numbers of discarded bits) is transform a random bit stream with a frequency of 1's different from 50% into a stream closer to that frequency.

Another technique for improving a near random bit stream is to exclusive-or the bit stream with the output of a high-quality cryptographically secure pseudorandom number generator
Cryptographically secure pseudorandom number generator

A cryptographically secure pseudo-random number generator is a pseudo-random number generator with properties that make it suitable for use in cryptography....
 such as Blum Blum Shub or a good stream cipher
Stream cipher

In cryptography, a stream cipher is a symmetric key algorithm cipher where plaintext bits are combined with a pseudorandom cipher bit stream , typically by an exclusive-or operation....
. This can cheaply improve decorrelation and digit bias.

A related method which reduces bias in a near random bit stream is to take two or more uncorrelated near random bit streams, and exclusive or them together. Let the probability of a bit stream producing a 0 be 1/2 + e, where -1/2 = e = 1/2. Then e is the bias of the bitstream. If two uncorrelated bit streams with bias e are exclusive-or-ed together, then the bias of the result will be 2e². This may be repeated with more bit streams. (See also Piling-up lemma
Piling-up lemma

In cryptanalysis, the piling-up lemma is a principle used in linear cryptanalysis to construct linear approximations to the action of block ciphers....
).

Some designs apply cryptographic hash function
Hash function

A hash function is any algorithm or function which converts a large, possibly variable-sized amount of data into a small datum, usually a single integer that may serve as an array index into an array....
s such as MD5
MD5

In cryptography, MD5 is a widely used cryptographic hash function with a 128-bit hash value. As an Internet standard , MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of computer file....
, SHA-1, or RIPEMD-160 or even a CRC
Cyclic redundancy check

A cyclic redundancy check is a type of function that takes as input a data stream of any length, and produces as output a value of a certain space, commonly a 32-bit integer....
 function to all or part of the bit stream, and then use the output as the random bit stream. This is attractive, partly because it is relatively fast compared to some other methods, but depends entirely on qualities in the hash output for which there may be little theoretical basis.

PRNG with periodically refreshed random key


Other designs use what are believed to be true random bits as the key
Key (cryptography)

In cryptography, a key is a piece of information that determines the functional output of a cryptographic algorithm or cipher. Without a key, the algorithm would have no result....
 for a high quality block cipher
Block cipher

In cryptography, a block cipher is a symmetric key algorithm cipher which operates on fixed-length groups of bits, termed blocks, with an unvarying transformation....
 algorithm, taking the encrypted output as the random bit stream. Care must be taken in these cases to select an appropriate block mode
Block cipher modes of operation

In cryptography, a block cipher operates on blocks of fixed length, often 64 or 128 bits. Because messages may be of any length, and because encrypting the same plaintext under the same key always produces the same output , several modes of operation have been invented which allow block ciphers to provide confidentiality for messages of arbit...
, however. In some implementations, the PRNG is run for a limited number of digits, while the hardware generating device produces a new seed.

Using observed events


Software engineers without true random number generators often try to develop them by measuring physical events available to the software. An example is measuring the time between user keystrokes, and then taking the least significant bit (or two or three) of the count as a random digit. A similar approach measures task-scheduling, network hits, disk-head seek times and other internal events. One Microsoft design includes a very long list of such internal values (see the CSPRNG
Cryptographically secure pseudorandom number generator

A cryptographically secure pseudo-random number generator is a pseudo-random number generator with properties that make it suitable for use in cryptography....
 article).

The method is risky when it uses computer-controlled events because a clever, malicious attacker might be able to predict a cryptographic key by controlling the external events. Several gambling frauds have been uncovered which rely on manipulating normally hidden events internal to the operation of computers or networks. It is also risky because the supposed user-generated event (e.g., keystrokes) can be spoofed
Spoofing attack

In the context of network security, a spoofing attack is a situation in which one person or program successfully masquerades as another by falsifying data and thereby gaining an illegitimate advantage....
 by a sufficiently ingenious attacker, allowing control of the "random values" used by the cryptography.

However, with sufficient care, a system can be designed that produces cryptographically secure random numbers from the sources of randomness available in a modern computer. The basic design is to maintain an "entropy pool" of random bits that are assumed to be unknown to an attacker. New randomness is added whenever available (for example, when the user hits a key) and an estimate of the number of bits in the pool that cannot be known to an attacker is kept. Some of the strategies in use include:

  • When random bits are requested, return that many bits derived from the entropy pool (by a cryptographic hash function, say) and decrement the estimate of the number of random bits remaining in the pool. If not enough unknown bits are available, wait until enough are available. This is the top-level design of the "/dev/random
    /dev/random

    In Unix-like operating systems, /dev/random is a special file that serves as a true random number generator or as a pseudorandom number generator....
    " device in Linux, written by Theodore Ts'o
    Theodore Ts'o

    Theodore Y. "Ted" Ts'o is a software developer mainly known for his contributions to the Linux kernel, in particular his contributions to file systems....
     and used in many other Unix-like operating systems. It provides high-quality random numbers so long as the estimates of the input randomness are sufficiently cautious. The Linux "/dev/urandom" device is a simple modification which disregards estimates of input randomness, and is therefore rather less likely to have high entropy as a result.
  • Maintain a stream cipher
    Stream cipher

    In cryptography, a stream cipher is a symmetric key algorithm cipher where plaintext bits are combined with a pseudorandom cipher bit stream , typically by an exclusive-or operation....
     with a key and IV
    Initialization vector

    In cryptography, an initialization vector is a block of bits that is required to allow a stream cipher or a block cipher to be executed in any of several block cipher modes of operation to produce a unique stream independent from other streams produced by the same encryption key, without having to go through a re-keying process....
     obtained from an entropy pool. When enough bits of entropy have been collected, replace both key and IV with new random values and decrease the estimated entropy remaining in the pool. This is the approach taken by the yarrow
    Yarrow algorithm

    The Yarrow algorithm is a cryptographically secure pseudorandom number generator. The name is taken from the yarrow plant, the stalks of which are dried and used as a randomising agent in I Ching divination....
     library. It provides resistance against some attacks and conserves hard-to-obtain entropy.


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. A physical example might be the rapidly decreasing radioactivity of the smoke detectors mentioned earlier. Failure modes in such devices are plentiful and are complicated, slow, and hard to detect.

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 include some such tests into the software that reads the device.

Just as with other components of a cryptosystem, a software random number generator should be designed to resist certain attacks. Defending against these attacks is difficult. See: random number generator attack
Random number generator attack

The security of cryptographic systems depends on some secret data that is known to authorized persons but unknown and unpredictable to others. To achieve this unpredictability, some randomization is typically employed....
.

Estimating entropy


There are mathematical techniques for estimating the entropy
Information entropy

In information theory, entropy is a measure of the uncertainty associated with a random variable. The term by itself in this context usually refers to the Shannon entropy, which quantifies, in the sense of an expected value, the self-information contained in a message, usually in units such as bits....
 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 pseudo-random generator.

Performance checks


Hardware random number generators should be constantly monitored for proper operation. RFC 4086 and FIPS
Federal Information Processing Standard

Federal Information Processing Standards are publicly announced Standardizations developed by the United States Federal government for use by all non-military government agencies and by government contractors....
 Pub 140-2
FIPS 140

The Federal Information Processing Standard 140 are series of publications numbered 140 which are a United States government of the United States computer security standardization that specify requirements for cryptographic modules....
 include tests which can be used for this. Also see the documentation for the New Zealand cryptographic software library cryptlib
Cryptlib

cryptlib is an open source cross-platform software security toolkit. It is distributed under the Sleepycat License, a free software license compatible with the GNU General Public License....
.

Since many practical designs rely on a hardware source as an input, it will be useful to at least check that the source is still operating. Statistical tests can often detect failure of a noise source, such as a radio station transmitting on a channel thought to be empty, for example. Noise generator output should be sampled for testing before being passed through a "whitener." Some whitener designs can pass statistical tests with no random input. While detecting a large deviation from perfection would be a sign that a true random noise source has become degraded, small deviations are normal and can be an indication of proper operation. Correlation of bias in the inputs to a generator design with other parameters (e.g., internal temperature, bus voltage) might be additionally useful as a further check. Unfortunately, with currently available (and foreseen) tests, passing such tests is not enough to be sure the output sequences are random. A carefully chosen design, verification that the manufactured device implements that design and continuous physical security to insure against tampering may all be needed in addition to testing for high value uses.

See also

  • Pseudorandom number generator
    Pseudorandom number generator

    A pseudorandom number generator is an algorithm for generating a sequence of numbers that approximates the properties of random numbers. The sequence is not truly random in that it is completely determined by a relatively small set of initial values, called the PRNG's state. Although sequences that are closer to truly random can be gen...
  • Random number generator
  • Random number generation
    Random number generation

    A random number generator is a computer or physical device designed to generate a sequence of numbers or symbols that lack any pattern, i.e. appear random....
  • Randomness extractor
    Randomness extractor

    A randomness extractor is a function which, when applied to a information entropy source , generates a random output that is shorter, yet Uniform distribution ....
  • Randomness
    Randomness

    Randomness is a lack of order, purpose, Causality, or predictability. Randomness as defined by Aristotle is the situation, when a choice is to be made which has no logical component by which to determine or make the choice ....
  • Bell test experiments
    Bell test experiments

    The Bell test experiments serve to investigate the validity of the quantum entanglement effect in quantum mechanics by using some kind of Bell inequality....
  • ERNIE
    Ernie

    Ernie is a fictional character, a The Muppets on the Public Broadcasting Service's long-running children's television show, Sesame Street. He and his roommate Bert form a Bert and Ernie that is one of the program's centerpieces, with Ernie acting the role of the na?ve troublemaker and Bert the world-weary foil ....
  • Lottery machine
    Lottery machine

    A lottery machine is the machine used to draw the winning numbers for a lottery.Early lotteries were done by drawing numbers, or winning tickets, from a container....
  • Peter Gutmann
    Peter Gutmann (computer scientist)

    Peter Gutmann is a computer science in the Department of Computer Science at the University of Auckland, Auckland, New Zealand. He has a Ph.D. in computer science from the University of Auckland....
     of the University of Auckland
    University of Auckland

    File:University Of Auckland Tamaki Campus.jpgThe University of Auckland is New Zealand's largest university and the top-ranked New Zealand university in the THES - QS World University Rankings....
     has produced an extensive analysis of "random number" generation with computers (and of several actual designs) in the documentation for the cryptlib cryptographic tool kit.
  • Nassim Nicholas Taleb


External links

  • (Replaces earlier RFC 1750.)
  • NIST Special Publication 800-22
  • at the American Scientist Online.
  • from Intel on the Intel hardware Random Number Generator built into Pentium family CPUs (after the PIII)


Code


  • (Randomness from video)
  • (Randomness from audio)
  • (Perl module
    Perl module

    A Perl module is a discrete component of software for the Perl programming language. A module is distinguished by a unique namespace, e.g. "CGI" or "Net::FTP" or "XML::Parser" and a filename similarly named ....
     that claims to generate actual random numbers from interrupt timing discrepancies)
  • John S. Denker
  • Oliver Lau