Subject: Re: Random bit generator in hardware...
Keywords: Random, Hardware
From: (John Rogers @ The Blue Wizard's Lab at SUNY-Binghamton)
Ok, ok, ok --- let me repeat and clarify my message:

>    Some time ago, I remembered there was an article on how to build a
> hardware random bit generator using a transistor, an op-amp, and few other
> other things.  I have the printout of this article (numbered 2073/2074 in
> sci.crypt for the folks who want references...)

   Yes, I only have a hardcopy of the original article.  The text will
appear later in this message.  And yes, this op-amp is assumed to be run
from a +5V supply (see that original article)

>    At any rate, I tried setting it up, and I couldn't make it work.  I am
> no hardware guy (I am a software programmer :-).  My ultimate motivation
> is to build a joystick dongle that generate 4-bit random number -- of
> course it is required that it depends exclusively on +5v supply only.
> This device has a nice feature...

   Note this emphasization.  I know that most op-amps such as 741s requires
the +/-15V biasing supply, which is awkward to do, to put it mildly :-)

   And to repeat my "help" message:

>    Anyone cares to help me out?  I would appreciate this tremendously.
> Just remember to provide an ASCII diagram of where/what to I
> don't have to worry about blowing yet another transistor!


     Ok, the original article I was referring to (including the corrected
remarks) is being quoted almost verbatim:


I've built the following and subjected it to autocorrelation, slicing,
and entropy examination for blocks of 1000 bytes.  It never came out
with less than 7.8 bits/byte entropy...

Take an ordinary NPN transistor.  Tie the collector to the base, and then
forward-bias it so you get about a 0.1 mA current through it (this was a 10K
resistor in my application).  Lead the connection between the resistor and the
transistor to the + input of an op-amp.  Tie the output of the op-amp to (1) a
50K resistor in series with a 10-microfarad capacitor, thence to ground and
(2) directly to the CPU input port.  Connect the 50K/10u junction to the -
input of the op-amp.  That's it.   (this, of course, presumes an op-amp that
can work on a +5V single-ended supply.  If you don't have one, then buffer the
op-amp output with a CMOS inverter.  This makes all the zeroes into ones, and
all the ones into zeroes, but since the bits are supposed to be random you'll
probably never notice).

If you want 4 bits at a time, build 4 such circuits.  Be sure to isolate their
power inputs (bypass caps are a good idea), so they don't start to oscillate
with each other and thereby start some sort of correlation.  It is probably
unnecessary to build more than one bit worth of this circuit - this circuit
will generate at least 100 very random bits per second.

Do the autocorrelation and entropy tests anyway, just to make sure you don't
have a electrically-noisy system that is "fixing" the numbers.


Copyright 1989 William S. Yerazunis (aka Crah the Merciless)
All rights reserved, no responsibility take.

     "I refuse to wear a 'power suit' unless it's powered armor!"


[ next article containing corrections to above article, which I have made, ]
[ and an explanation of the idea behind this thing:                        ]

(the idea is that the transistor-resistor junction will have a few milli-
volts of noise on it, and that noise can be amplified to give the random
bit stream.  The average voltage of that junction (averaged by the 50K/10uF
capacitor) provides the decision threshold between 0 and 1.)


     There you have it!  Happy hacking!
     And oh by the way, I know transistors are peanuts --- know,
I just don't like blown transistors   :-P

         //  Only Amiga | The Blue Wizard  (John Rogers)
        //  gives you a | (Don't toucha my wand or I will breaka ya!)
    \\ // creative edge | #include 
     \X/                | cat flames >/dev/null