Cryptography Lecture 6 Notes
Cryptography Lecture 6 Notes
RANDOMNESS
— The generation of a sequence of allegedly random numbers being random in some well-
defined statistical sense has been a concern.
— Two criteria are used to validate that a sequence of numbers is random:
o Uniform distribution:
The frequency of occurrence of ones and zeros should be
approximately equal.
o Independence:
No one subsequence in the sequence can be inferred from the others.
PSEUDORANDOM NUMBERS
— Cryptographic applications typically make use of algorithmic techniques for random
number generation.
— These algorithms are deterministic and therefore produce sequences of numbers that
are not statistically random.
— If the algorithm is good, the resulting sequences will pass many tests of randomness and
are referred to as pseudorandom numbers.
TRNG / PRNG / PRF
PRNG REQUIREMENTS
— The basic requirement when a PRNG or PRF is used for a cryptographic application is
that an adversary who does not know the seed is unable to determine the
pseudorandom string.
— The requirement for secrecy of the output of a PRNG or PRF leads to specific
requirements in the areas of:
o Randomness
o Unpredictability
o Characteristics of the seed
RANDOMNESS
— The generated bit stream needs to appear random even though it is deterministic.
— There is no single test that can determine if a PRNG generates numbers that have the
characteristic of randomness
o If the PRNG exhibits randomness on the basis of multiple tests, then it can be
assumed to satisfy the randomness requirement.
— NIST SP 800-22 specifies that the tests should seek to establish three characteristics:
o Uniformity: # 1= #0
o Scalability: sub-sequences are random as well
o Consistency: consistent across seeds
UNPREDICTABILITY
— A stream of pseudorandom numbers should exhibit two forms of unpredictability:
— Forward unpredictability:
o If the seed is unknown, the next output bit in the sequence should be
unpredictable in spite of any knowledge of previous bits in the sequence.
— Backward unpredictability:
o It should not be feasible to determine the seed from knowledge of any
generated values. No correlation between a seed and any value generated from
that seed should be evident; each element of the sequence should appear to be
the outcome of an independent random event whose probability is ½.
— The same set of tests for randomness also provides a test of unpredictability.
o A random sequence will have no correlation with a fixed value (the seed)
SEED REQUIREMENTS
— The seed that serves as input to the PRNG must be secure and unpredictable.
— The seed itself must be a random or pseudorandom number.
— Typically the seed is generated by TRNG.
GENERATION OF SEED INPUT TO PRNG
— PRN is much longer than TRN.
— TRNG may produce a binary string with some bias.
— TRNG may be not fast enough.
PRNG DESIGN
— Algorithms fall into two categories:
o Purpose-built algorithms:
Algorithms designed specifically and solely for the purpose of
generating pseudorandom bit streams.
Example RC4 in WEP
o Algorithms based on existing cryptographic algorithms:
Have the effect of randomizing input data.
LINEAR CONGRUENTIAL GENERATOR
— An algorithm first proposed by Lehmer that is parameterized with four numbers:
o m the modulus m>0
o a the multiplier 0 < a< m
o c the increment 0≤ c < m
o X0 the starting value, or seed 0 ≤ X0 < m
— The sequence of random numbers {Xn} is obtained via the following iterative equation.
— Xn+1 = (aXn + c) mod m
— If m , a , c , and X0 are integers, then this technique will produce a sequence of integers
with each integer in the range 0 ≤ Xn < m
— The selection of values for a , c , and m is critical in developing a good random number
generator m is typically near to or equal to 231.
SKEW
— A TRNG may produce an output that is biased in some way, such as having more ones
than zeros or vice versa.
o Deskewing algorithms
o Methods of modifying a bit stream to reduce or eliminate the bias.
o One approach is to pass the bit stream through a hash function such as MD5
or SHA-1
o RFC 4086 recommends collecting input from multiple hardware sources and
then mixing these using a hash function to produce random output.
— Operating systems typically provide a built-in mechanism for generating random
numbers:
o Linux uses four entropy sources: mouse and keyboard activity, disk I/O
operations, and specific interrupts.
o Bits are generated from these four sources and combined in a pooled buffer.
o When random bits are needed the appropriate number of bits are read from the
buffer and passed through the SHA-1 hash function
COMPARISON OF PRNGs AND TRNGs
STREAM CIPHERS
STRENGTH OF RC4
SUMMARY
— Principles of pseudorandom number generation
o The use of random numbers
o TRNGs, PRNGs, and PRFs
o PRNG requirements
o Algorithm design
— Pseudorandom number generators
o Linear congruential generators
o Blum Blum Shub generator
— Pseudorandom number generation using a block cipher.
o PRNG using block cipher modes of operation.
o ANSI X9.17 PRNG
— Stream ciphers
— RC4
o Initialization of S
o Stream generation
o Strength of RC4
— True random number generators
o Entropy sources
o Comparison of PRNGs and TRNGs
o Skew