Random Noise Sources

PRELIMINARY Noise Source Experiments

A Ciphers By Ritter Page


Terry Ritter


1999-03-30


It has been long assumed that physically generated random noise can yield cryptographically unpredictable random numbers. These preliminary designs are the first step in a several-step process of producing cryptographic random numbers.

Any electronics experimenter can build a noise source. Unfortunately, building a good noise source is harder than it looks. Correctly using such a source is harder still.

Post-Processing

In these designs, I assume that subsequent post-processing is not optional, but required. The production of analog noise is just the first step in producing cryptographic values. The advantage in raw noise is the ability to see the quality of the generator separate from the cryptographic output. In most cases, post-processing will hide major defects in the random device. Without post-processing, we should see the generator values fit a distribution corresponding to the noise source itself, so we can have confidence that we are seeing real random noise. Only then can we in confidence process the data to accumulate "entropy," remove statistical "bias," and return "bits."

Strategies

I have constructed a sequence of analog noise generators for analysis. My first approach was a zener noise circuit, using a simulated zener IC to support low-voltage operation. The second was just a consumer FM radio, with noise from semiconductor RF amplification and mixing taken directly from headphone output. Subsequent realizations include a pseudonoise generator (to calibrate the noise card), a narrowband IF strip, and a voltage-mode generator with improved white output.

For those generators intended for actual random number usage, the generators are battery powered, so there is no AC "hum" or switching noise which might be mistaken for quantum noise. They are completely enclosed in their own ferrous and electrically-conductive "tea tin," so there is no magnetic, electrostatic, or electromagnetic field sensitivity to worry about. (If we tune the FM receiver to a local station, we can put the top on the can and listen through the can as the signal drops into noise.) The only hole in each enclosure is the shielded RCA jack used to deliver the analog noise.

Target: Sound Card

The intent of these generators is to deliver analog noise to be digitized by an ordinary sound card. Since we have to amplify our low-level noise, it seems like we could reduce our effort by using the sound card microphone input. Unfortunately, the usual SB16 sound card (there are a variety of different SB16 models) needs about 100 mv from the mike, at low impedance. This is a huge signal for a microphone; it implies an internal amplifier. The microphone input on my SB16 has a measured input impedance of about 2k to ground, which is unexpectedly low.

The SB16 microphone input connection is a stereo miniature jack, but only the "tip" contact is used for signal; the "ring" contact is used to supply power. The power is apparently used by FET's in the internal amplifier of the electret type condenser microphones which are now common. This internal amplification is presumably how we can expect such a large signal from a microphone.

Some web searching turns up a variety of comments by people who got voice-recognition software and tried to use, for example, a dynamic mike in their sound card. While I have been unable to find input level and connection specifications from the card manufacturer, there are some comments on sound card microphone inputs in the Sound Blaster Microphone Preamplifier page.

We will just be supplying noise signal to the sound card, and not using the voltage from the card, thus avoiding any possibility that the power line might affect the quality of the delivered noise.

The "First Cut" Zener Noise Design

My first approach was to produce zener noise, which has been used many times. But in published circuits, this always had the problem that higher voltages were required than we might prefer. The voltage problem is attacked here by using an IC "zener" device, which has a low zener voltage. Also, some past designs have used digital circuits in so-called linear modes, again to support low-voltage operation. The intent here is to pretty much use the components the way they were intended to be used.

[Zener Noise First Cut]

This circuit functions below 3 volts! Part values are generally non-critical, except for the LM336, which is fairly common.

The IC Zener LM336

A zener diode is a semiconductor junction operated in reverse bias breakdown, and built to take the power dissipation of such operation. Good low-voltage zeners are not available, which is why we have a simulated zener in an IC.

The low zener voltage supports long battery life in operation. Moreover, the spec sheet clearly lays out the noise of the device. We can hope to find that very same frequency response in our results, which would be a strong indication that we were measuring that device, as opposed to some other unknown signal.

The 2N2222 Transistor

The first transistor is used to convert current noise from the zener into amplified current noise in the collector, which is seen as voltage noise across the collector resistor. Since bipolars amplify current, sensing current noise seems to be more appropriate than sensing voltage noise.

Every bipolar transistor must be biased properly: here we want the collector to rest at some reasonable middle level so that noise peaks are not cut off in either direction. We can do that by using the zener itself, which apparently forces about 3.1 v on the collector. (We operate the zener at very low currents, however, so it is out of regulation and has a lower voltage.) The collector noise signal is filtered out by the capacitor, giving an average level to the zener. The capacitor also provides a current "ground" for the noise signal produced by the zener and flowing through the transistor base.

The second transistor amplifies the signal to a level usable by the sound card microphone input. It has two different bias systems: first, filtered feedback bias which does not affect the signal gain, and second, a germanium diode on the transistor base. The diode clamps signals below ground to about -0.3 v, but more importantly charges the input capacitor from negative peaks, which thus provides additional bias to avoid such peaks in the future.

The 2N2222 is my favorite general-purpose experimental transistor: it handles reasonable voltage and power, and has good gain with reasonable linearity. But there is nothing magic about this device, and pretty much any small-signal NPN will do here. As far as I know, the 2N2222 is still in production after almost 30 years, and it fits our requirements. Modern transistors are not better if we do not use whatever advantages they may have: We have no need for high voltage, power, frequency or gain.

AirBoard Construction

To see how a circuit performs we must construct it. The hard way would be to lay out a printed-circuit board, drill it and populate it. This is a long delay, and a lot of work for something which may be wildly changed.

Another way to construct the circuit would be to insert the parts through perforated circuit board. This is better, but is still too much overhead for new designs where every part may change (and thus must be removed and replaced) during development. [AirBoard Thumbnail]

So instead of a first "breadboard," I construct an "AirBoard": I usually start with power and ground bus wires, then tack-solder parts to those, and to each other. If we leave these leads long we can connect most parts directly, in a three-dimensional volume. More complex circuits will benefit from insulating the leads and partitioning into smaller developments.

Zener First Cut Measured Performance

We design a circuit to generate noise, implement the circuit, then record that noise using a sound card. All of the recordings here are CD-quality monaural: 16-bit samples at 44.1 KHz. These are very large files for short sounds.

Once we have recorded the noise, we can inspect the spectral qualities by using a Fast Fourier Transform (FFT). Here we use the Spectra PLUS FFT display by Sound Technology Inc. The FFT display gives us the ability to see what we have, and the effects of our changes. Spectra PLUS is a fabulous tool, and a spectral display is necessary for noise hardware development. But Spectra PLUS is also very expensive, with irritating option pricing and copy-protection. It is to be hoped that marketplace competition will solve these problems.

All of the FFT results shown here are the average of 100 different 1024-point FFT's using a Hamming window. This is random noise, and any one FFT computation can look peculiar; only the average of many such computations gives the (relatively) smooth curve we might at first expect. The numbers across the bottom (100 to 20.0k) represent frequency in Hertz; the numbers on the left represent relative amplitude in decibels, a logarithmic measure. The sound-card input level was not changed between any of these FFT's, so these relative levels have the same meaning in each graph.

[Spectrum for First Cut Design]

Note that our spectrum is not flat, thus not "white." There is more low-frequency noise than high-frequency noise, so our noise is "pink." Technically, for ideal pink noise, the amplitude should decrease by 3 dB per octave, which is about what we see here. Since a single RC filter will roll off at 6 dB per octave, it is not possible to use a simple filter on white noise to get pink noise.

The Consumer FM Noise Approach

A battery-powered consumer FM radio is placed in a metallic can as a shield. The radio is placed in monaural mode, and the output taken across one of the earphones. An appropriate level for the sound card is slightly audible a foot or two away.

Consumer FM Measured Performance

[Spectrum for Consumer FM Noise]

Notice that we have significant high-frequency rolloff. Something like this is the expected result of 75 usec "de-emphasis" time-constant in the broadcast FM process. We do seem to approach the expected -6 dB / octave slope at the high frequencies.

(Noise in FM reception tends to be "white," which has the same energy in each Hz of bandwidth. This means that most energy is in the high frequencies, which is annoying to humans. We can minimize this by pre-emphasizing the transmitted sound, so that the audio highs are magnified or emphasized in the transmitted signal. Then we de-emphasize highs in the receiver, which cuts the noise, and returns the audio system response to approximately flat.)

A Pseudonoise Spectrum

As a check on the capabilities of the sound card, I implemented a noise generator based on the old MM5837 Digital Noise Generator IC. I suspect that we could do better with a CMOS LFSR, but this was simpler.

Pseudonoise Measured Performance

[Spectrum for MM5837 pseudonoise]

It thus appears that the sound card has a good frequency response, certainly good enough for noise work. It seems likely that the dip at the high end is the start of the necessary low-pass filter to prevent aliasing effects from the 44.1 kHz sampling rate. (Suppose we have a signal of 28 kHz and sample at 44.1 kHz; we can expect to see a spurious 16 kHz component which does not in fact exist. This is a result of sampling a frequency above the Nyquist limit, which is half the sampling rate.)

Noise from Narrowband 10.7 MHz FM IF Strip

At one time it made sense to have a separate IF and audio section into which various front-end RF down converters could be connected. In such a section we have some tuned circuits and a mixer which down converts the 10.7 MHz IF to 455 KHz. The signal is amplified and limited at 455 KHz, and (apparently) slope-detected. The de-emphasis components were opened and audio taken before the on-board amp. The intent was to view so-called "FM noise."

Narrowband FM Measured Performance

[Spectrum for Narrowband FM]

This is not a bad result, but required some real-time tuning and interaction with the spectral display to achieve. It is also a very technical solution, with lots of amplification and tuned circuits. The noise source itself was localized (by opening the circuit at various stages) to the first stage, a mixer transistor. Presumably, we see amplified transistor noise from 10.7 MHz. (It would be interesting to see how a PLL detector would respond; if we could eliminate the de-emphasis, we might get an FM noise-source without coils.)

The "Second Cut" Zener Noise Design

To improve the overall linearity, an LM386 audio amp chip replaces the output transistor.

[Zener Noise Second Cut]

The LM386 Audio Amp Chip

[The Tin Box]

The LM386 is not a high-power amp, but we do not need power. It is simple, but more importantly, it operates over the wide voltage range we expect to encounter in battery operation. The first cut worked down below 3 volts; this new version is limited by the output amp to about 3.5 volts (4 volts guaranteed). This is still very good.

The rated life of a 9-volt battery generally assumes that the output will decline to 4 volts. If we can use this low voltage, we can use the full energy resources of the battery, which is about 580 ma/h for an alkaline version. Since the circuit works to 4 volts, and uses about 5 ma, we expect about 100 hours of operational life per battery. That is a lot of bits.

Zener and Amp Measured Performance

[Spectrum from Zener and Amplifier]

As we can see, the current-mode zener noise is "pink"-like. Ideally, we would of course prefer a "white" response, although that may not matter after processing.

Not shown in the above diagram are "gain pins" 1 and 8 on the LM386 chip. By connecting a capacitor between those pins, we can increase the gain by another 20 dB. By selecting the value of that capacitor, we can select the frequency at which the gain increase takes hold. By adding a 0.22 uF cap across the gain pins, we can compensate the response, to an extent.

Zener and Compensated Amp Measured Performance

[Spectrum from Zener and Compensated Amp]

If we were selling these things, we might say this spectrum is "white" +/- 3 dB to about 18 KHz. In fact, we are "equalizing" the very pink signal spectrum, and there is just so much we can do. Eventually the 20 dB additional gain of the LM386 has been used up, while the pink roll off continues. Here we over-compensate a little early to stave off the eventual decline.

Again, we have no reason to believe that we need a perfect "white" source to generate random data, provided we use substantial post-processing. Since we assume such processing, this could be a very acceptable noise source in actual use.

Voltage Mode Zener Noise Design

Previously, we have amplified zener noise current, which seems to produce a generally pink spectrum. The alternate approach would be to amplify zener noise voltage. This is very tiny, however, which means we need a lot more amplification. Here we use two of the LM386 amps.

[Voltage Mode Zener Noise]

One of the big problems with this circuit is the need for so much gain. Each LM386 nominally contributes 26 dB, but each has gain pins which make it 46 dB, each. This is 92 dB total gain, which can easily get out of hand, producing various oscillations and interactions.

[The Generator and its Box]

Here we have the ordinary tea-tin, with an RCA jack in the end (at the bottom of the picture). The 9 volt battery is taped to the bottom of the can, and a mercury switch is taped at an angle on one side. We turn the generator "on" by tipping it up on end. It works.

[Generator Board in Detail]

This version is built on a bit of double-sided bare circuit board. The top level is ground ("earth"), with power on the opposite side. The capacitors at the top filter power; the red wires at the right deliver power from the other side of the board. (Had there been oscillation trouble, I would have drilled through by the power pins and supplied power with an 1/8 inch lead from power-plane, which is what I do for digital circuits.)

Depending on our video display settings, we should be able to see most component values; the obvious exception being the vertical 15K resistor from the power side to the zener IC. The chips have their leads cut short with the ground pin and one input pin soldered to the ground plane.

The intent of placement was to try to distance low-level input signals from the resulting high-level output. A slightly larger board might have helped keep the output capacitor completely on the high-level end. And I could have put the zener chip closer to the top.

Voltage Mode Performance: Input Open, No Gain Caps

[Spectrum for Inherent Noise]

Here we have the noise of the amplifying system, with the zener coupling capacitor opened, the first amp thus having only the internal 50K input resistor. To the left we have the typical 1/f semiconductor noise. Note that the amplitude range has been extended to 60 dB for this spectrum only; without that, most of the graph was below the window.

Voltage Mode Performance: Zener Noise, No Gain Caps

[Spectrum for Zener Noise]

With the zener coupling cap reconnected, we have 6 or 7 dB more noise than the amp alone. We still have that 1/f region, however, and the amplitude is pretty low.

Voltage Mode Performance: Zener Noise, One Gain Cap

[Spectrum for Zener Noise]

Here we have a 10 uF gain cap in the first amp. Note how this value cuts the 1/f region. This is a pretty good spectrum, maybe +/- 1 dB to 20 KHz. The amplitude is a little low, though.

Voltage Mode Performance: Zener Noise, Both Gain Caps

[Spectrum for Zener Noise, w/ Gain Caps]

Here we have both 10 uF gain caps, one for each amp. Again, the 1/f region is flattened, and the resulting signal amplitude is about what we had with the earlier transistor and single-amp system.

But there are serious problems here: First, we do not see the gain increase that we expect for some reason. Also, the .WAV file looks biased.

[WAV Display]

See how most of the samples are above the zero line? See how the waveform looks more "fluffy" on the bottom? It is possible that we are somehow clipping some of the signal. So even though the spectrum is about as good is we can expect from a real device, we are probably better off leaving the gain pins open on the second amp.

In most of these designs, the signal is capacitively coupled to the (+) amplifier input. Ideally, we would similarly couple the (-) input to ground, which would reduce output offset. But in the prototype with an 8.7 volt supply, we have 4.6v and 4.4v on the two amplifier outputs, and these are very reasonable values.

Current Prototype Performance (Zener, 2 Amps, 1 Gain Cap)

[Spectrum for Zener Noise]

From looking at the .wav file, the output seems far more balanced than the previous version. But it will take some detailed analysis before we know just what we have.

Last updated: 1999-03-30