As per Relevance of the word recommendations, we have this rfc below:











Network Working Group D. Eastlake, 3
Request for Comments: 1750
Category: Informational S.

J.

December 1994


Randomness Recommendations for

Status of this

This memo provides information for the Internet community. This
does not specify an Internet standard of any kind. Distribution
this memo is unlimited



Security systems today are built on increasingly strong
algorithms that foil pattern analysis attempts. However, the
of these systems is dependent on generating secret quantities
passwords, cryptographic keys, and similar quantities. The use
pseudo-random processes to generate secret quantities can result
pseudo-security. The sophisticated attacker of these
systems may find it easier to reproduce the environment that
the secret quantities, searching the resulting small set
possibilities, than to locate the quantities in the whole of
number space

Choosing random quantities to foil a resourceful and
adversary is surprisingly difficult. This paper points out
pitfalls in using traditional pseudo-random number
techniques for choosing such quantities. It recommends the use
truly random hardware techniques and shows that the existing
on many systems can be used for this purpose. It
suggestions to ameliorate the problem when a hardware solution is
available. And it gives examples of how large such quantities
to be for some particular applications












Eastlake, Crocker & Schiller [Page 1]

RFC 1750 Randomness Recommendations for Security December 1994




Comments on this document that have been incorporated were
from (in alphabetic order) the following

David M. Balenson (TIS
Don Coppersmith (IBM
Don T. Davis (consultant
Carl Ellison (Stratus
Marc Horowitz (MIT
Christian Huitema (INRIA
Charlie Kaufman (IRIS
Steve Kent (BBN
Hal Murray (DEC
Neil Haller (Bellcore
Richard Pitkin (DEC
Tim Redmond (TIS
Doug Tygar (CMU

Table of

1. Introduction........................................... 3
2. Requirements........................................... 4
3. Traditional Pseudo-Random Sequences.................... 5
4. Unpredictability....................................... 7
4.1 Problems with Clocks and Serial Numbers............... 7
4.2 Timing and Content of External Events................ 8
4.3 The Fallacy of Complex Manipulation.................. 8
4.4 The Fallacy of Selection from a Large Database....... 9
5. Hardware for Randomness............................... 10
5.1 Volume Required...................................... 10
5.2 Sensitivity to Skew.................................. 10
5.2.1 Using Stream Parity to De-Skew..................... 11
5.2.2 Using Transition Mappings to De-Skew............... 12
5.2.3 Using FFT to De-Skew............................... 13
5.2.4 Using Compression to De-Skew....................... 13
5.3 Existing Hardware Can Be Used For Randomness......... 14
5.3.1 Using Existing Sound/Video Input................... 14
5.3.2 Using Existing Disk Drives......................... 14
6. Recommended Non-Hardware Strategy..................... 14
6.1 Mixing Functions..................................... 15
6.1.1 A Trivial Mixing Function.......................... 15
6.1.2 Stronger Mixing Functions.......................... 16
6.1.3 Diff-Hellman as a Mixing Function.................. 17
6.1.4 Using a Mixing Function to Stretch Random Bits..... 17
6.1.5 Other Factors in Choosing a Mixing Function........ 18
6.2 Non-Hardware Sources of Randomness................... 19
6.3 Cryptographically Strong Sequences................... 19



Eastlake, Crocker & Schiller [Page 2]

RFC 1750 Randomness Recommendations for Security December 1994


6.3.1 Traditional Strong Sequences....................... 20
6.3.2 The Blum Blum Shub Sequence Generator.............. 21
7. Key Generation Standards.............................. 22
7.1 US DoD Recommendations for Password Generation....... 23
7.2 X9.17 Key Generation................................. 23
8. Examples of Randomness Required....................... 24
8.1 Password Generation................................. 24
8.2 A Very High Security Cryptographic Key............... 25
8.2.1 Effort per Key Trial............................... 25
8.2.2 Meet in the Middle Attacks......................... 26
8.2.3 Other Considerations............................... 26
9. Conclusion............................................ 27
10. Security Considerations.............................. 27
References............................................... 28
Authors' Addresses....................................... 30

1.

Software cryptography is coming into wider use. Systems
Kerberos, PEM, PGP, etc. are maturing and becoming a part of
network landscape [PEM]. These systems provide
protection against snooping and spoofing. However, there is
potential flaw. At the heart of all cryptographic systems is
generation of secret, unguessable (i.e., random) numbers

For the present, the lack of generally available facilities
generating such unpredictable numbers is an open wound in the
of cryptographic software. For the software developer who wants
build a key or password generation procedure that runs on a
range of hardware, the only safe strategy so far has been to
the local installation to supply a suitable routine to
random numbers. To say the least, this is an awkward, error-
and unpalatable solution

It is important to keep in mind that the requirement is for data
an adversary has a very low probability of guessing or determining
This will fail if pseudo-random data is used which only
traditional statistical tests for randomness or which is based
limited range sources, such as clocks. Frequently such
quantities are determinable by an adversary searching through
embarrassingly small space of possibilities

This informational document suggests techniques for producing
quantities that will be resistant to such attack. It recommends
future systems include hardware random number generation or
access to existing hardware that can be used for this purpose.
suggests methods for use if such hardware is not available. And
gives some estimates of the number of random bits required for



Eastlake, Crocker & Schiller [Page 3]

RFC 1750 Randomness Recommendations for Security December 1994


applications

2.

Probably the most commonly encountered randomness requirement
is the user password. This is usually a simple character string
Obviously, if a password can be guessed, it does not
security. (For re-usable passwords, it is desirable that users
able to remember the password. This may make it advisable to
pronounceable character strings or phrases composed on
words. But this only affects the format of the password information
not the requirement that the password be very hard to guess.)

Many other requirements come from the cryptographic arena
Cryptographic techniques can be used to provide a variety of
including confidentiality and authentication. Such services
based on quantities, traditionally called "keys", that are unknown
and unguessable by an adversary

In some cases, such as the use of symmetric encryption with the
time pads [CRYPTO*] or the US Data Encryption Standard [DES],
parties who wish to communicate confidentially and/or
authentication must all know the same secret key. In other cases
using what are called asymmetric or "public key"
techniques, keys come in pairs. One key of the pair is private
must be kept secret by one party, the other is public and can
published to the world. It is computationally infeasible
determine the private key from the public key [ASYMMETRIC, CRYPTO*].

The frequency and volume of the requirement for random
differs greatly for different cryptographic systems. Using pure
[CRYPTO*], random quantities are required when the key pair
generated, but thereafter any number of messages can be
without any further need for randomness. The public key
Signature Algorithm that has been proposed by the US
Institute of Standards and Technology (NIST) requires good
numbers for each signature. And encrypting with a one time pad,
principle the strongest possible encryption technique, requires
volume of randomness equal to all the messages to be processed

In most of these cases, an adversary can try to determine
"secret" key by trial and error. (This is possible as long as
key is enough smaller than the message that the correct key can
uniquely identified.) The probability of an adversary succeeding
this must be made acceptably low, depending on the
application. The size of the space the adversary must search
related to the amount of key "information" present in the
theoretic sense [SHANNON]. This depends on the number of



Eastlake, Crocker & Schiller [Page 4]

RFC 1750 Randomness Recommendations for Security December 1994


secret values possible and the probability of each value as follows

-----
\
Bits-of-info = \ - p * log ( p )
/ i 2
/
-----

where i varies from 1 to the number of possible secret values and
sub i is the probability of the value numbered i. (Since p sub i
less than one, the log will be negative so each term in the sum
be non-negative.)

If there are 2^n different values of equal probability, then n
of information are present and an adversary would, on the average
have to try half of the values, or 2^(n-1) , before guessing
secret quantity. If the probability of different values is unequal
then there is less information present and fewer guesses will,
average, be required by an adversary. In particular, any values
the adversary can know are impossible, or are of low probability,
be initially ignored by an adversary, who will search through
more probable values first

For example, consider a cryptographic system that uses 56 bit keys
If these 56 bit keys are derived by using a fixed pseudo-
number generator that is seeded with an 8 bit seed, then an
needs to search through only 256 keys (by running the pseudo-
number generator with every possible seed), not the 2^56 keys
may at first appear to be the case. Only 8 bits of "information"
in these 56 bit keys

3. Traditional Pseudo-Random

Most traditional sources of random numbers use deterministic
of "pseudo-random" numbers. These typically start with a "seed
quantity and use numeric or logical operations to produce a
of values

[KNUTH] has a classic exposition on pseudo-random numbers
Applications he mentions are simulation of natural phenomena
sampling, numerical analysis, testing computer programs,
making, and games. None of these have the same characteristics
the sort of security uses we are talking about. Only in the last
could there be an adversary trying to find the random quantity
However, in these cases, the adversary normally has only a
chance to use a guessed value. In guessing passwords or
to break an encryption scheme, the adversary normally has many



Eastlake, Crocker & Schiller [Page 5]

RFC 1750 Randomness Recommendations for Security December 1994


perhaps unlimited, chances at guessing the correct value and
be assumed to be aided by a computer

For testing the "randomness" of numbers, Knuth suggests a variety
measures including statistical and spectral. These tests
things like autocorrelation between different parts of a "random
sequence or distribution of its values. They could be met by
constant stored random sequence, such as the "random"
printed in the CRC Standard Mathematical Tables [CRC].

A typical pseudo-random number generation technique, known as
linear congruence pseudo-random number generator, is
arithmetic where the N+1th value is calculated from the Nth value

V = ( V * a + b )(Mod c
N+1

The above technique has a strong relationship to linear
register pseudo-random number generators, which are well
cryptographically [SHIFT*]. In such generators bits are
at one end of a shift register as the Exclusive Or (binary
without carry) of bits from selected fixed taps into the register

For example

+----+ +----+ +----+ +----+
| B | <-- | B | <-- | B | <-- . . . . . . <-- | B | <-+
| 0 | | 1 | | 2 | | n | |
+----+ +----+ +----+ +----+ |
| | | |
| | V +-----+
| V +----------------> | |
V +-----------------------------> | XOR |
+---------------------------------------------------> | |
+-----+


V = ( ( V * 2 ) + B .xor. B ... )(Mod 2^n
N+1 N 0 2

The goodness of traditional pseudo-random number generator
is measured by statistical tests on such sequences. Carefully
values of the initial V and a, b, and c or the placement of
register tap in the above simple processes can produce
statistics






Eastlake, Crocker & Schiller [Page 6]

RFC 1750 Randomness Recommendations for Security December 1994


These sequences may be adequate in simulations (Monte
experiments) as long as the sequence is orthogonal to the
of the space being explored. Even there, subtle patterns may
problems. However, such sequences are clearly bad for use
security applications. They are fully predictable if the
state is known. Depending on the form of the pseudo-random
generator, the sequence may be determinable from observation of
short portion of the sequence [CRYPTO*, STERN]. For example,
the generators above, one can determine V(n+1) given knowledge
V(n). In fact, it has been shown that with these techniques, even
only one bit of the pseudo-random values is released, the seed can
determined from short sequences

Not only have linear congruent generators been broken, but
are now known for breaking all polynomial congruent
[KRAWCZYK].

4.

Randomness in the traditional sense described in section 3 is NOT
same as the unpredictability required for security use

For example, use of a widely available constant sequence, such
that from the CRC tables, is very weak against an adversary.
they learn of or guess it, they can easily break all security,
and past, based on the sequence [CRC]. Yet the
properties of these tables are good

The following sections describe the limitations of some
generation techniques and sources

4.1 Problems with Clocks and Serial

Computer clocks, or similar operating system or hardware values
provide significantly fewer real bits of unpredictability than
appear from their specifications

Tests have been done on clocks on numerous systems and it was
that their behavior can vary widely and in unexpected ways.
version of an operating system running on one set of hardware
actually provide, say, microsecond resolution in a clock while
different configuration of the "same" system may always provide
same lower bits and only count in the upper bits at much
resolution. This means that successive reads on the clock
produce identical values even if enough time has passed that
value "should" change based on the nominal clock resolution.
are also cases where frequently reading a clock can
artificial sequential values because of extra code that checks



Eastlake, Crocker & Schiller [Page 7]

RFC 1750 Randomness Recommendations for Security December 1994


the clock being unchanged between two reads and increases it by one
Designing portable application code to generate unpredictable
based on such system clocks is particularly challenging because
system designer does not always know the properties of the
clocks that the code will execute on

Use of a hardware serial number such as an Ethernet address may
provide fewer bits of uniqueness than one would guess.
quantities are usually heavily structured and subfields may have
a limited range of possible values or values easily guessable
on approximate date of manufacture or other data. For example, it
likely that most of the Ethernet cards installed on Digital
Corporation (DEC) hardware within DEC were manufactured by
itself, which significantly limits the range of built in addresses

Problems such as those described above related to clocks and
numbers make code to produce unpredictable quantities difficult
the code is to be ported across a variety of computer platforms
systems

4.2 Timing and Content of External

It is possible to measure the timing and content of mouse movement
key strokes, and similar user events. This is a reasonable source
unguessable data with some qualifications. On some machines,
such as key strokes are buffered. Even though the user's inter
keystroke timing may have sufficient variation and unpredictability
there might not be an easy way to access that variation.
problem is that no standard method exists to sample timing details
This makes it hard to build standard software intended
distribution to a large range of machines based on this technique

The amount of mouse movement or the keys actually hit are
easier to access than timings but may yield less unpredictability
the user may provide highly repetitive input

Other external events, such as network packet arrival times, can
be used with care. In particular, the possibility of manipulation
such times by an adversary must be considered

4.3 The Fallacy of Complex

One strategy which may give a misleading appearance
unpredictability is to take a very complex algorithm (or an
traditional pseudo-random number generator with good
properties) and calculate a cryptographic key by starting with
current value of a computer system clock as the seed. An
who knew roughly when the generator was started would have



Eastlake, Crocker & Schiller [Page 8]

RFC 1750 Randomness Recommendations for Security December 1994


relatively small number of seed values to test as they would
likely values of the system clock. Large numbers of pseudo-
bits could be generated but the search space an adversary would
to check could be quite small

Thus very strong and/or complex manipulation of data will not help
the adversary can learn what the manipulation is and there is
enough unpredictability in the starting seed value. Even if they
not learn what the manipulation is, they may be able to use
limited number of results stemming from a limited number of
values to defeat security

Another serious strategy error is to assume that a very
pseudo-random number generation algorithm will produce strong
numbers when there has been no theory behind or analysis of
algorithm. There is a excellent example of this fallacy right
the beginning of chapter 3 in [KNUTH] where the author describes
complex algorithm. It was intended that the machine language
corresponding to the algorithm would be so complicated that a
trying to read the code without comments wouldn't know what
program was doing. Unfortunately, actual use of this
showed that it almost immediately converged to a single
value in one case and a small cycle of values in another case

Not only does complex manipulation not help you if you have a
range of seeds but blindly chosen complex manipulation can
the randomness in a good seed

4.4 The Fallacy of Selection from a Large

Another strategy that can give a misleading appearance
unpredictability is selection of a quantity randomly from a
and assume that its strength is related to the total number of
in the database. For example, typical USENET servers as of this
process over 35 megabytes of information per day. Assume a
quantity was selected by fetching 32 bytes of data from a
starting point in this data. This does not yield 32*8 = 256
worth of unguessability. Even after allowing that much of the
is human language and probably has more like 2 or 3 bits
information per byte, it doesn't yield 32*2.5 = 80 bits
unguessability. For an adversary with access to the same 35
megabytes the unguessability rests only on the starting point of
selection. That is, at best, about 25 bits of unguessability in
case

The same argument applies to selecting sequences from the data on
CD ROM or Audio CD recording or any other large public database.
the adversary has access to the same database, this "selection from



Eastlake, Crocker & Schiller [Page 9]

RFC 1750 Randomness Recommendations for Security December 1994


large volume of data" step buys very little. However, if a
can be made from data to which the adversary has no access, such
system buffers on an active multi-user system, it may be of
help

5. Hardware for

Is there any hope for strong portable randomness in the future
There might be. All that's needed is a physical source
unpredictable numbers

A thermal noise or radioactive decay source and a fast, free-
oscillator would do the trick directly [GIFFORD]. This is a
amount of hardware, and could easily be included as a standard
of a computer system's architecture. Furthermore, any system with
spinning disk or the like has an adequate source of
[DAVIS]. All that's needed is the common perception among
vendors that this small additional hardware and the software
access it is necessary and useful

5.1 Volume

How much unpredictability is needed? Is it possible to quantify
requirement in, say, number of random bits per second

The answer is not very much is needed. For DES, the key is 56
and, as we show in an example in Section 8, even the highest
system is unlikely to require a keying material of over 200 bits.
a series of keys are needed, it can be generated from a strong
seed using a cryptographically strong sequence as explained
Section 6.3. A few hundred random bits generated once a day would
enough using such techniques. Even if the random bits are
as slowly as one per second and it is not possible to overlap
generation process, it should be tolerable in high
applications to wait 200 seconds occasionally

These numbers are trivial to achieve. It could be done by a
repeatedly tossing a coin. Almost any hardware process is likely
be much faster

5.2 Sensitivity to

Is there any specific requirement on the shape of the distribution
the random numbers? The good news is the distribution need not
uniform. All that is needed is a conservative estimate of how non
uniform it is to bound performance. Two simple techniques to de-
the bit stream are given below and stronger techniques are
in Section 6.1.2 below



Eastlake, Crocker & Schiller [Page 10]

RFC 1750 Randomness Recommendations for Security December 1994


5.2.1 Using Stream Parity to De-

Consider taking a sufficiently long string of bits and map the
to "zero" or "one". The mapping will not yield a perfectly
distribution, but it can be as close as desired. One mapping
serves the purpose is to take the parity of the string. This has
advantages that it is robust across all degrees of skew up to
estimated maximum skew and is absolutely trivial to implement
hardware

The following analysis gives the number of bits that must be sampled

Suppose the ratio of ones to zeros is 0.5 + e : 0.5 - e, where e
between 0 and 0.5 and is a measure of the "eccentricity" of
distribution. Consider the distribution of the parity function of
bit samples. The probabilities that the parity will be one or
will be the sum of the odd or even terms in the binomial expansion
(p + q)^N, where p = 0.5 + e, the probability of a one, and q = 0.5 -
e, the probability of a zero

These sums can be computed easily

N
1/2 * ( ( p + q ) + ( p - q ) )

N
1/2 * ( ( p + q ) - ( p - q ) ).

(Which one corresponds to the probability the parity will be 1
depends on whether N is odd or even.)

Since p + q = 1 and p - q = 2e, these expressions reduce


1/2 * [1 + (2e) ]


1/2 * [1 - (2e) ].

Neither of these will ever be exactly 0.5 unless e is zero, but
can bring them arbitrarily close to 0.5. If we want
probabilities to be within some delta d of 0.5, i.e.


( 0.5 + ( 0.5 * (2e) ) ) < 0.5 + d






Eastlake, Crocker & Schiller [Page 11]

RFC 1750 Randomness Recommendations for Security December 1994


Solving for N yields N > log(2d)/log(2e). (Note that 2e is less
1, so its log is negative. Division by a negative number
the sense of an inequality.)

The following table gives the length of the string which must
sampled for various degrees of skew in order to come within 0.001
a 50/50 distribution

+---------+--------+-------+
| Prob(1) | e | N |
+---------+--------+-------+
| 0.5 | 0.00 | 1 |
| 0.6 | 0.10 | 4 |
| 0.7 | 0.20 | 7 |
| 0.8 | 0.30 | 13 |
| 0.9 | 0.40 | 28 |
| 0.95 | 0.45 | 59 |
| 0.99 | 0.49 | 308 |
+---------+--------+-------+

The last entry shows that even if the distribution is skewed 99%
favor of ones, the parity of a string of 308 samples will be
0.001 of a 50/50 distribution

5.2.2 Using Transition Mappings to De-

Another technique, originally due to von Neumann [VON NEUMANN], is
examine a bit stream as a sequence of non-overlapping pairs.
could then discard any 00 or 11 pairs found, interpret 01 as a 0
10 as a 1. Assume the probability of a 1 is 0.5+e and
probability of a 0 is 0.5-e where e is the eccentricity of the
and described in the previous section. Then the probability of
pair is as follows

+------+-----------------------------------------+
| pair | probability |
+------+-----------------------------------------+
| 00 | (0.5 - e)^2 = 0.25 - e + e^2 |
| 01 | (0.5 - e)*(0.5 + e) = 0.25 - e^2 |
| 10 | (0.5 + e)*(0.5 - e) = 0.25 - e^2 |
| 11 | (0.5 + e)^2 = 0.25 + e + e^2 |
+------+-----------------------------------------+

This technique will completely eliminate any bias but at the
of taking an indeterminate number of input bits for any
desired number of output bits. The probability of any
pair being discarded is 0.5 + 2e^2 so the expected number of
bits to produce X output bits is X/(0.25 - e^2).



Eastlake, Crocker & Schiller [Page 12]

RFC 1750 Randomness Recommendations for Security December 1994


This technique assumes that the bits are from a stream where each
has the same probability of being a 0 or 1 as any other bit in
stream and that bits are not correlated, i.e., that the bits
identical independent distributions. If alternate bits were from
correlated sources, for example, the above analysis breaks down

The above technique also provides another illustration of how
simple statistical analysis can mislead if one is not always on
lookout for patterns that could be exploited by an adversary. If
algorithm were mis-read slightly so that overlapping successive
pairs were used instead of non-overlapping pairs, the
analysis given is the same; however, instead of provided an
uncorrelated series of random 1's and 0's, it instead produces
totally predictable sequence of exactly alternating 1's and 0's

5.2.3 Using FFT to De-

When real world data consists of strongly biased or correlated bits
it may still contain useful amounts of randomness. This
can be extracted through use of the discrete Fourier transform or
optimized variant, the FFT

Using the Fourier transform of the data, strong correlations can
discarded. If adequate data is processed and remaining
decay, spectral lines approaching statistical independence
normally distributed randomness can be produced [BRILLINGER].

5.2.4 Using Compression to De-

Reversible compression techniques also provide a crude method of de
skewing a skewed bit stream. This follows directly from
definition of reversible compression and the formula in Section 2
above for the amount of information in a sequence. Since
compression is reversible, the same amount of information must
present in the shorter output than was present in the longer input
By the Shannon information equation, this is only possible if,
average, the probabilities of the different shorter sequences
more uniformly distributed than were the probabilities of the
sequences. Thus the shorter sequences are de-skewed relative to
input

However, many compression techniques add a somewhat
preface to their output stream and may insert such a sequence
periodically in their output or otherwise introduce subtle
of their own. They should be considered only a rough
compared with those described above or in Section 6.1.2. At
minimum, the beginning of the compressed sequence should be
and only later bits used for applications requiring random bits



Eastlake, Crocker & Schiller [Page 13]

RFC 1750 Randomness Recommendations for Security December 1994


5.3 Existing Hardware Can Be Used For

As described below, many computers come with hardware that can,
care, be used to generate truly random quantities

5.3.1 Using Existing Sound/Video

Increasingly computers are being built with inputs that digitize
real world analog source, such as sound from a microphone or
input from a camera. Under appropriate circumstances, such input
provide reasonably high quality random bits. The "input" from
sound digitizer with no source plugged in or a camera with the
cap on, if the system has enough gain to detect anything,
essentially thermal noise

For example, on a SPARCstation, one can read from the /dev/
device with nothing plugged into the microphone jack. Such data
essentially random noise although it should not be trusted
some checking in case of hardware failure. It will, in any case
need to be de-skewed as described elsewhere

Combining this with compression to de-skew one can, in UNIXese
generate a huge amount of medium quality random data by

cat /dev/audio | compress - >random-bits-

5.3.2 Using Existing Disk

Disk drives have small random fluctuations in their rotational
due to chaotic air turbulence [DAVIS]. By adding low level disk
time instrumentation to a system, a series of measurements can
obtained that include this randomness. Such data is usually
correlated so that significant processing is needed, including
(see section 5.2.3). Nevertheless experimentation has shown that
with such processing, disk drives easily produce 100 bits a minute
more of excellent random data

Partly offsetting this need for processing is the fact that
drive failure will normally be rapidly noticed. Thus, problems
this method of random number generation due to hardware failure
very unlikely

6. Recommended Non-Hardware

What is the best overall strategy for meeting the requirement
unguessable random numbers in the absence of a reliable
source? It is to obtain random input from a large number
uncorrelated sources and to mix them with a strong mixing function



Eastlake, Crocker & Schiller [Page 14]

RFC 1750 Randomness Recommendations for Security December 1994


Such a function will preserve the randomness present in any of
sources even if other quantities being combined are fixed or
guessable. This may be advisable even with a good hardware source
hardware can also fail, though this should be weighed against
increase in the chance of overall failure due to added
complexity

6.1 Mixing

A strong mixing function is one which combines two or more inputs
produces an output where each output bit is a different complex non
linear function of all the input bits. On average, changing
input bit will change about half the output bits. But because
relationship is complex and non-linear, no particular output bit
guaranteed to change when any particular input bit is changed

Consider the problem of converting a stream of bits that is
towards 0 or 1 to a shorter stream which is more random, as
in Section 5.2 above. This is simply another case where a
mixing function is desired, mixing the input bits to produce
smaller number of output bits. The technique given in Section 5.2.1
of using the parity of a number of bits is simply the result
successively Exclusive Or'ing them which is examined as a
mixing function immediately below. Use of stronger mixing
to extract more of the randomness in a stream of skewed bits
examined in Section 6.1.2.

6.1.1 A Trivial Mixing

A trivial example for single bit inputs is the Exclusive Or function
which is equivalent to addition without carry, as show in the
below. This is a degenerate case in which the one output bit
changes for a change in either input bit. But, despite
simplicity, it will still provide a useful illustration

+-----------+-----------+----------+
| input 1 | input 2 | output |
+-----------+-----------+----------+
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
+-----------+-----------+----------+

If inputs 1 and 2 are uncorrelated and combined in this fashion
the output will be an even better (less skewed) random bit than
inputs. If we assume an "eccentricity" e as defined in Section 5.2
above, then the output eccentricity relates to the input



Eastlake, Crocker & Schiller [Page 15]

RFC 1750 Randomness Recommendations for Security December 1994


as follows

e = 2 * e *
output input 1 input 2

Since e is never greater than 1/2, the eccentricity is
improved except in the case where at least one input is a
skewed constant. This is illustrated in the following table
the top and left side values are the two input eccentricities and
entries are the output eccentricity

+--------+--------+--------+--------+--------+--------+--------+
| e | 0.00 | 0.10 | 0.20 | 0.30 | 0.40 | 0.50 |
+--------+--------+--------+--------+--------+--------+--------+
| 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0.10 | 0.00 | 0.02 | 0.04 | 0.06 | 0.08 | 0.10 |
| 0.20 | 0.00 | 0.04 | 0.08 | 0.12 | 0.16 | 0.20 |
| 0.30 | 0.00 | 0.06 | 0.12 | 0.18 | 0.24 | 0.30 |
| 0.40 | 0.00 | 0.08 | 0.16 | 0.24 | 0.32 | 0.40 |
| 0.50 | 0.00 | 0.10 | 0.20 | 0.30 | 0.40 | 0.50 |
+--------+--------+--------+--------+--------+--------+--------+

However, keep in mind that the above calculations assume that
inputs are not correlated. If the inputs were, say, the parity
the number of minutes from midnight on two clocks accurate to a
seconds, then each might appear random if sampled at random
much longer than a minute. Yet if they were both sampled
combined with xor, the result would be zero most of the time

6.1.2 Stronger Mixing

The US Government Data Encryption Standard [DES] is an example of
strong mixing function for multiple bit quantities. It takes up
120 bits of input (64 bits of "data" and 56 bits of "key")
produces 64 bits of output each of which is dependent on a
non-linear function of all input bits. Other strong
functions with this characteristic can also be used by
them to mix all of their key and data input bits

Another good family of mixing functions are the "message digest"
hashing functions such as The US Government Secure Hash
[SHS] and the MD2, MD4, MD5 [MD2, MD4, MD5] series. These
all take an arbitrary amount of input and produce an output
all the input bits. The MD* series produce 128 bits of output and
produces 160 bits






Eastlake, Crocker & Schiller [Page 16]

RFC 1750 Randomness Recommendations for Security December 1994


Although the message digest functions are designed for
amounts of input, DES and other encryption functions can also be
to combine any number of inputs. If 64 bits of output is adequate
the inputs can be packed into a 64 bit data quantity and
56 bit keys, padding with zeros if needed, which are then used
successively encrypt using DES in Electronic Codebook Mode [
MODES]. If more than 64 bits of output are needed, use more
mixing. For example, if inputs are packed into three quantities, A
B, and C, use DES to encrypt A with B as a key and then with C as
key to produce the 1st part of the output, then encrypt B with C
then A for more output and, if necessary, encrypt C with A and then
for yet more output. Still more output can be produced by
the order of the keys given above to stretch things. The same can
done with the hash functions by hashing various subsets of the
data to produce multiple outputs. But keep in mind that it
impossible to get more bits of "randomness" out than are put in

An example of using a strong mixing function would be to
the case of a string of 308 bits each of which is biased 99%
zero. The parity technique given in Section 5.2.1 above reduced
to one bit with only a 1/1000 deviance from being equally likely
zero or one. But, applying the equation for information given
Section 2, this 308 bit sequence has 5 bits of information in it
Thus hashing it with SHS or MD5 and taking the bottom 5 bits of
result would yield 5 unbiased random bits as opposed to the
bit given by calculating the parity of the string

6.1.3 Diffie-Hellman as a Mixing

Diffie-Hellman exponential key exchange is a technique that yields
shared secret between two parties that can be made
infeasible for a third party to determine even if they can
all the messages between the two communicating parties. This
secret is a mixture of initial quantities generated by each of
[D-H]. If these initial quantities are random, then the
secret contains the combined randomness of them both, assuming
are uncorrelated

6.1.4 Using a Mixing Function to Stretch Random

While it is not necessary for a mixing function to produce the
or fewer bits than its inputs, mixing bits cannot "stretch"
amount of random unpredictability present in the inputs. Thus
inputs of 32 bits each where there is 12 bits worth
unpredicatability (such as 4,096 equally probable values) in
input cannot produce more than 48 bits worth of unpredictable output
The output can be expanded to hundreds or thousands of bits by,
example, mixing with successive integers, but the clever adversary'



Eastlake, Crocker & Schiller [Page 17]

RFC 1750 Randomness Recommendations for Security December 1994


search space is still 2^48 possibilities. Furthermore, mixing
fewer bits than are input will tend to strengthen the randomness
the output the way using Exclusive Or to produce one bit from two
above

The last table in Section 6.1.1 shows that mixing a random bit with
constant bit with Exclusive Or will produce a random bit. While
is true, it does not provide a way to "stretch" one random bit
more than one. If, for example, a random bit is mixed with a 0
then with a 1, this produces a two bit sequence but it will always
either 01 or 10. Since there are only two possible values, there
still only the one bit of original randomness

6.1.5 Other Factors in Choosing a Mixing

For local use, DES has the advantages that it has been widely
for flaws, is widely documented, and is widely implemented
hardware and software implementations available all over the
including source code available by anonymous FTP. The SHS and MD
family are younger algorithms which have been less tested but
is no particular reason to believe they are flawed. Both MD5 and
were derived from the earlier MD4 algorithm. They all have
code available by anonymous FTP [SHS, MD2, MD4, MD5].

DES and SHS have been vouched for the the US National Security
(NSA) on the basis of criteria that primarily remain secret.
this is the cause of much speculation and doubt, investigation of
over the years has indicated that NSA involvement in modifications
its design, which originated with IBM, was primarily to
it. No concealed or special weakness has been found in DES. It
almost certain that the NSA modification to MD4 to produce the
similarly strengthened the algorithm, possibly against threats
yet known in the public cryptographic community

DES, SHS, MD4, and MD5 are royalty free for all purposes. MD2
been freely licensed only for non-profit use in connection
Privacy Enhanced Mail [PEM]. Between the MD* algorithms, some
believe that, as with "Goldilocks and the Three Bears", MD2 is
but too slow, MD4 is fast but too weak, and MD5 is just right

Another advantage of the MD* or similar hashing algorithms
encryption algorithms is that they are not subject to the
regulations imposed by the US Government prohibiting the
export or import of encryption/decryption software and hardware.
same should be true of DES rigged to produce an irreversible
code but most DES packages are oriented to reversible encryption





Eastlake, Crocker & Schiller [Page 18]

RFC 1750 Randomness Recommendations for Security December 1994


6.2 Non-Hardware Sources of

The best source of input for mixing would be a hardware
such as disk drive timing affected by air turbulence, audio
with thermal noise, or radioactive decay. However, if that is
available there are other possibilities. These include
clocks, system or input/output buffers, user/system/hardware/
serial numbers and/or addresses and timing, and user input
Unfortunately, any of these sources can produce limited
predicatable values under some circumstances

Some of the sources listed above would be quite strong on multi-
systems where, in essence, each user of the system is a source
randomness. However, on a small single user system, such as
typical IBM PC or Apple Macintosh, it might be possible for
adversary to assemble a similar configuration. This could give
adversary inputs to the mixing process that were
correlated to those used originally as to make exhaustive
practical

The use of multiple random inputs with a strong mixing function
recommended and can overcome weakness in any particular input.
example, the timing and content of requested "random" user
can yield hundreds of random bits but conservative assumptions
to be made. For example, assuming a few bits of randomness if
inter-keystroke interval is unique in the sequence up to that
and a similar assumption if the key hit is unique but assuming
no bits of randomness are present in the initial key value or if
timing or key value duplicate previous values. The results of
these timings and characters typed could be further combined
clock values and other inputs

This strategy may make practical portable code to produce good
numbers for security even if some of the inputs are very weak on
of the target systems. However, it may still fail against a
grade attack on small single user systems, especially if
adversary has ever been able to observe the generation process in
past. A hardware based random source is still preferable

6.3 Cryptographically Strong

In cases where a series of random quantities must be generated,
adversary may learn some values in the sequence. In general,
should not be able to predict other values from the ones that
know






Eastlake, Crocker & Schiller [Page 19]

RFC 1750 Randomness Recommendations for Security December 1994


The correct technique is to start with a strong random seed,
cryptographically strong steps from that seed [CRYPTO2, CRYPTO3],
do not reveal the complete state of the generator in the
elements. If each value in the sequence can be calculated in a
way from the previous value, then when any value is compromised,
future values can be determined. This would be the case,
example, if each value were a constant function of the
used values, even if the function were a very strong, non-
message digest function

It should be noted that if your technique for generating a
of key values is fast enough, it can trivially be used as the
for a confidentiality system. If two parties use the same
generating technique and start with the same seed material, they
generate identical sequences. These could, for example, be xor'ed
one end with data being send, encrypting it, and xor'ed with
data as received, decrypting it due to the reversible properties
the xor operation

6.3.1 Traditional Strong

A traditional way to achieve a strong sequence has been to have
values be produced by hashing the quantities produced
concatenating the seed with successive integers or the like and
mask the values obtained so as to limit the amount of generator
available to the adversary

It may also be possible to use an "encryption" algorithm with
random key and seed value to encrypt and feedback some or all of
output encrypted value into the value to be encrypted for the
iteration. Appropriate feedback techniques will usually
recommended with the encryption algorithm. An example is shown
where shifting and masking are used to combine the cypher
feedback. This type of feedback is recommended by the US
in connection with DES [DES MODES].
















Eastlake, Crocker & Schiller [Page 20]

RFC 1750 Randomness Recommendations for Security December 1994


+---------------+
| V |
| | n |
+--+------------+
| | +---------+
| +---------> | | +-----+
+--+ | Encrypt | <--- | Key |
| +-------- | | +-----+
| | +---------+
V
+------------+--+
| V | |
| n+1 |
+---------------+

Note that if a shift of one is used, this is the same as the
register technique described in Section 3 above but with the
important difference that the feedback is determined by a
non-linear function of all bits rather than a simple linear
polynomial combination of output from a few bit position taps

It has been shown by Donald W. Davies that this sort of
partial output feedback significantly weakens an algorithm
will feeding all of the output bits back as input. In particular
for DES, repeated encrypting a full 64 bit quantity will give
expected repeat in about 2^63 iterations. Feeding back anything
than 64 (and more than 0) bits will give an expected repeat
between 2**31 and 2**32 iterations

To predict values of a sequence from others when the sequence
generated by these techniques is equivalent to breaking
cryptosystem or inverting the "non-invertible" hashing involved
only partial information available. The less information
each iteration, the harder it will be for an adversary to predict
sequence. Thus it is best to use only one bit from each value.
has been shown that in some cases this makes it impossible to break
system even when the cryptographic system is invertible and can
broken if all of each generated value was revealed

6.3.2 The Blum Blum Shub Sequence

Currently the generator which has the strongest public proof
strength is called the Blum Blum Shub generator after its
[BBS]. It is also very simple and is based on quadratic residues
It's only disadvantage is that is is computationally
compared with the traditional techniques give in 6.3.1 above.
is not a serious draw back if it is used for moderately
purposes, such as generating session keys



Eastlake, Crocker & Schiller [Page 21]

RFC 1750 Randomness Recommendations for Security December 1994


Simply choose two large prime numbers, say p and q, which both
the property that you get a remainder of 3 if you divide them by 4.
Let n = p * q. Then you choose a random number x relatively prime
n. The initial seed for the generator and the method for
subsequent values are

2
s = ( x )(Mod n
0

2
s = ( s )(Mod n
i+1

You must be careful to use only a few bits from the bottom of each s
It is always safe to use only the lowest order bit. If you use
more than

log ( log ( s ) )
2 2

low order bits, then predicting any additional bits from a
generated in this manner is provable as hard as factoring n. As
as the initial x is secret, you can even make n public if you want

An intersting characteristic of this generator is that you
directly calculate any of the s values. In


( ( 2 )(Mod (( p - 1 ) * ( q - 1 )) ) )
s = ( s )(Mod n
i 0

This means that in applications where many keys are generated in
fashion, it is not necessary to save them all. Each key can
effectively indexed and recovered from that small index and
initial s and n

7. Key Generation

Several public standards are now in place for the generation of keys
Two of these are described below. Both use DES but any
strong or stronger mixing function could be substituted








Eastlake, Crocker & Schiller [Page 22]

RFC 1750 Randomness Recommendations for Security December 1994


7.1 US DoD Recommendations for Password

The United States Department of Defense has specific
for password generation [DoD]. They suggest using the US
Encryption Standard [DES] in Output Feedback Mode [DES MODES]
follows

use an initialization vector determined
the system clock
system ID
user ID,
date and time
use a key determined
system interrupt registers
system status registers,
system counters; and
as plain text, use an external randomly generated 64
quantity such as 8 characters typed in by a
administrator

The password can then be calculated from the 64 bit "cipher text
generated in 64-bit Output Feedback Mode. As many bits as are
can be taken from these 64 bits and expanded into a
word, phrase, or other format if a human being needs to remember
password

7.2 X9.17 Key

The American National Standards Institute has specified a method
generating a sequence of keys as follows

s is the initial 64 bit
0

g is the sequence of generated 64 bit key


k is a random key reserved for generating this key

t is the time at which a key is generated to as fine a
as is available (up to 64 bits).

DES ( K, Q ) is the DES encryption of quantity Q with key








Eastlake, Crocker & Schiller [Page 23]

RFC 1750 Randomness Recommendations for Security December 1994


g = DES ( k, DES ( k, t ) .xor. s )
n

s = DES ( k, DES ( k, t ) .xor. g )
n+1

If g sub n is to be used as a DES key, then every eighth bit
be adjusted for parity for that use but the entire 64 bit
g should be used in calculating the next s

8. Examples of Randomness

Below are two examples showing rough calculations of
randomness for security. The first is for moderate
passwords while the second assumes a need for a very high
cryptographic key

8.1 Password

Assume that user passwords change once a year and it is desired
the probability that an adversary could guess the password for
particular account be less than one in a thousand. Further
that sending a password to the system is the only way to try
password. Then the crucial question is how often an adversary
try possibilities. Assume that delays have been introduced into
system so that, at most, an adversary can make one password try
six seconds. That's 600 per hour or about 15,000 per day or
5,000,000 tries in a year. Assuming any sort of monitoring, it
unlikely someone could actually try continuously for a year.
fact, even if log files are only checked monthly, 500,000 tries
more plausible before the attack is noticed and steps taken to
passwords and make it harder to try more passwords

To have a one in a thousand chance of guessing the password
500,000 tries implies a universe of at least 500,000,000 passwords
about 2^29. Thus 29 bits of randomness are needed. This can
be achieved using the US DoD recommended inputs for
generation as it has 8 inputs which probably average over 5 bits
randomness each (see section 7.1). Using a list of 1000 words,
password could be expressed as a three word phrase (1,000,000,000
possibilities) or, using case insensitive letters and digits,
would suffice ((26+10)^6 = 2,176,782,336 possibilities).

For a higher security password, the number of bits required goes up
To decrease the probability by 1,000 requires increasing the
of passwords by the same factor which adds about 10 bits. Thus
have only a one in a million chance of a password being guessed
the above scenario would require 39 bits of randomness and a



Eastlake, Crocker & Schiller [Page 24]

RFC 1750 Randomness Recommendations for Security December 1994


that was a four word phrase from a 1000 word list or
letters/digits. To go to a one in 10^9 chance, 49 bits of
are needed implying a five word phrase or ten letter/digit password

In a real system, of course, there are also other factors.
example, the larger and harder to remember passwords are, the
likely users are to write them down resulting in an additional
of compromise

8.2 A Very High Security Cryptographic

Assume that a very high security key is needed for
encryption / decryption between two parties. Assume an adversary
observe communications and knows the algorithm being used.
the field of random possibilities, the adversary can try key
in hopes of finding the one in use. Assume further that brute
trial of keys is the best the adversary can do

8.2.1 Effort per Key

How much effort will it take to try each key? For very high
applications it is best to assume a low value of effort. Even if
would clearly take tens of thousands of computer cycles or more
try a single key, there may be some pattern that enables huge
of key values to be tested with much less effort per key. Thus it
probably best to assume no more than a couple hundred cycles per key
(There is no clear lower bound on this as computers operate
parallel on a number of bits and a poor encryption algorithm
allow many keys or even groups of keys to be tested in parallel
However, we need to assume some value and can hope that a
strong algorithm has been chosen for our hypothetical high
task.)

If the adversary can command a highly parallel processor or a
network of work stations, 2*10^10 cycles per second is probably
minimum assumption for availability today. Looking forward just
couple years, there should be at least an order of
improvement. Thus assuming 10^9 keys could be checked per second
3.6*10^11 per hour or 6*10^13 per week or 2.4*10^14 per month
reasonable. This implies a need for a minimum of 51 bits
randomness in keys to be sure they cannot be found in a month.
then it is possible that, a few years from now, a highly
and resourceful adversary could break the key in 2 weeks (on
they need try only half the keys).







Eastlake, Crocker & Schiller [Page 25]

RFC 1750 Randomness Recommendations for Security December 1994


8.2.2 Meet in the Middle

If chosen or known plain text and the resulting encrypted text
available, a "meet in the middle" attack is possible if the
of the encryption algorithm allows it. (In a known plain
attack, the adversary knows all or part of the messages
encrypted, possibly some standard header or trailer fields. In
chosen plain text attack, the adversary can force some chosen
text to be encrypted, possibly by "leaking" an exciting text
would then be sent by the adversary over an encrypted channel.)

An oversimplified explanation of the meet in the middle attack is
follows: the adversary can half-encrypt the known or chosen
text with all possible first half-keys, sort the output, then half
decrypt the encoded text with all the second half-keys. If a
is found, the full key can be assembled from the halves and used
decrypt other parts of the message or other messages. At its best
this type of attack can halve the exponent of the work required
the adversary while adding a large but roughly constant factor
effort. To be assured of safety against this, a doubling of
amount of randomness in the key to a minimum of 102 bits is required

The meet in the middle attack assumes that the
algorithm can be decomposed in this way but we can not rule that
without a deep knowledge of the algorithm. Even if a basic
is not subject to a meet in the middle attack, an attempt to
a stronger algorithm by applying the basic algorithm twice (or
different algorithms sequentially) with different keys may gain
added security than would be expected. Such a composite
would be subject to a meet in the middle attack

Enormous resources may be required to mount a meet in the
attack but they are probably within the range of the
security services of a major nation. Essentially all nations spy
other nations government traffic and several nations are believed
spy on commercial traffic for economic advantage

8.2.3 Other

Since we have not even considered the possibilities of
purpose code breaking hardware or just how much of a safety margin
want beyond our assumptions above, probably a good minimum for a
high security cryptographic key is 128 bits of randomness
implies a minimum key length of 128 bits. If the two parties
on a key by Diffie-Hellman exchange [D-H], then in principle
half of this randomness would have to be supplied by each party
However, there is probably some correlation between their
inputs so it is probably best to assume that each party needs



Eastlake, Crocker & Schiller [Page 26]

RFC 1750 Randomness Recommendations for Security December 1994


provide at least 96 bits worth of randomness for very high
if Diffie-Hellman is used

This amount of randomness is beyond the limit of that in the
recommended by the US DoD for password generation and could
user typing timing, hardware random number generation, or
sources

It should be noted that key length calculations such at those
are controversial and depend on various assumptions about
cryptographic algorithms in use. In some cases, a professional
a deep knowledge of code breaking techniques and of the strength
the algorithm in use could be satisfied with less than half of
key size derived above

9.

Generation of unguessable "random" secret quantities for security
is an essential but difficult task

We have shown that hardware techniques to produce such
would be relatively simple. In particular, the volume and
would not need to be high and existing computer hardware, such
disk drives, can be used. Computational techniques are available
process low quality random quantities from multiple sources or
larger quantity of such low quality input from one source and
a smaller quantity of higher quality, less predictable key material
In the absence of hardware sources of randomness, a variety of
and software sources can frequently be used instead with care
however, most modern systems already have hardware, such as
drives or audio input, that could be used to produce high
randomness

Once a sufficient quantity of high quality seed key material (a
hundred bits) is available, strong computational techniques
available to produce cryptographically strong sequences
unpredicatable quantities from this seed material

10. Security

The entirety of this document concerns techniques and
for generating unguessable "random" quantities for use as passwords
cryptographic keys, and similar security uses








Eastlake, Crocker & Schiller [Page 27]

RFC 1750 Randomness Recommendations for Security December 1994




[ASYMMETRIC] - Secure Communications and Asymmetric Cryptosystems
edited by Gustavus J. Simmons, AAAS Selected Symposium 69,
Press, Inc

[BBS] - A Simple Unpredictable Pseudo-Random Number Generator,
Journal on Computing, v. 15, n. 2, 1986, L. Blum, M. Blum, & M. Shub

[BRILLINGER] - Time Series: Data Analysis and Theory, Holden-Day
1981, David Brillinger

[CRC] - C.R.C. Standard Mathematical Tables, Chemical
Publishing Company

[CRYPTO1] - Cryptography: A Primer, A Wiley-Interscience Publication
John Wiley & Sons, 1981, Alan G. Konheim

[CRYPTO2] - Cryptography: A New Dimension in Computer Data Security
A Wiley-Interscience Publication, John Wiley & Sons, 1982, Carl H
Meyer & Stephen M. Matyas

[CRYPTO3] - Applied Cryptography: Protocols, Algorithms, and
Code in C, John Wiley & Sons, 1994, Bruce Schneier

[DAVIS] - Cryptographic Randomness from Air Turbulence in
Drives, Advances in Cryptology - Crypto '94, Springer-Verlag
Notes in Computer Science #839, 1984, Don Davis, Ross Ihaka,
Philip Fenstermacher

[DES] - Data Encryption Standard, United States of America
Department of Commerce, National Institute of Standards
Technology, Federal