












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!













(^1) Edited and expanded by Richard Xu in Spring 2020.
(^2) Even lawyers grapple with this question, with a recent example being the debate of whether fantasy football is a game of chance or of skill.
(^3) In fact such a function must exist in some sense since in the entire history of the world, presumably no sequence of 100 fair coin tosses has ever repeated.
Reading: Katz-Lindell Section 3.3, Boneh-Shoup Chapter 3^1 The nature of randomness has troubled philosophers, scientists, statisticians and laypeople for many years.^2 Over the years people have given different answers to the question of what does it mean for data to be random, and what is the nature of probability. The move- ments of the planets initially looked random and arbitrary, but then early astronomers managed to find order and make some predictions on them. Similarly, we have made great advances in predicting the weather and will probably continue to do so. So, while these days it seems as if the event of whether or not it will rain a week from today is random , we could imagine that in the future we will be able to predict the weather accurately. Even the canonical notion of a random experiment -tossing a coin - might not be as ran- dom as youโd think: the second toss will have the same result as the first one with about a 51% chance. (Though see also this experiment.) It is conceivable that at some point someone would discover some function ๐น that, given the first 100 coin tosses by any given person, can predict the value of the 101๐ ๐ก.^3 In all these examples, the physics underlying the event, whether itโs the planetsโ movement, the weather, or coin tosses, did not change but only our powers to predict them. So to a large extent, randomness is a function of the observer , or in other words If a quantity is hard to compute, it might as well be random.
Much of cryptography is about trying to make this intuition more formal, and harnessing it to build secure systems. The basic object we want is the following:
Compiled on 11.17.2021 22:
92 an intensive introduction to cryptography
Definition 3.1 โ Pseudorandom generator (concrete). A function ๐บ โถ {0, 1}๐^ โ {0, 1}โ^ is a (๐ , ๐) pseudorandom generator if ๐บ(๐๐) โ๐ ,๐ ๐โ where ๐๐ก denotes the uniform distribution on {0, 1}๐ก.
That is, ๐บ is a (๐ , ๐) pseudorandom generator if no circuit of at most ๐ gates can distinguish with bias better than ๐ between the output of ๐บ (on a random input) and a uniformly random string of the same length. Spelling this out fully, this means that for every function ๐ท โถ {0, 1}โ^ โ {0, 1} computable using at most ๐ operations,
โฃ Pr ๐ฅโ๐ {0,1}๐ [๐ท(๐บ(๐ฅ)) = 1] โ Pr ๐ฆโ๐ {0,1}โ
As we did for the case of encryption, we will typically use asymp- totic terms to describe cryptographic pseudorandom generator. We say that ๐บ is simply a pseudorandom generator if it is efficiently com- putable and it is (๐(๐), 1/๐(๐))-pseudorandom generator for every polynomial ๐(โ ). In other words, we define pseudorandom generators as follows:
Definition 3.2 โ Pseudorandom generator. Let ๐บ โถ {0, 1}โ^ โ {0, 1}โ^ be some function computable in polynomial time. We say that ๐บ is a pseudorandom generator with length function โ โถ โ โ โ (where โ(๐) > ๐) if
|Pr[๐ท(๐บ(๐๐)) = 1] โ Pr[๐ท(๐โ) = 1]| < (^) ๐(๐)^1 (3.1)
Another way to say it, is that a polynomial-time computable func- tion ๐บ mapping ๐ bits strings to โ(๐) > ๐ bit strings is a pseudo- random generator if the two distributions ๐บ(๐๐) and ๐โ(๐) are compu- tationally indistinguishable.
P This definition (as is often the case in cryptography) is a bit long, but the concept of a pseudorandom gen- erator is central to cryptography, and so you should take your time and make sure you understand it. In- tuitively, a function ๐บ is a pseudorandom generator if (1) it expands its input (mapping ๐ bits to ๐ + 1 or more) and (2) we cannot distinguish between the out-
94 an intensive introduction to cryptography
(^5) Because we use a small input to grow a large pseu- dorandom string, the input to a pseudorandom generator is often known as its seed.
As was the case for the cipher conjecture, and any other conjecture, there are two natural questions regarding the PRG conjecture: why should we believe it and why should we care. Fortunately, the answer to the first question is simple: it is known that the cipher conjecture implies the PRG conjecture, and hence if we believe the former we should believe the latter. (The proof is highly non-trivial and we may not get to see it in this course.) As for the second question, we will see that the PRG conjecture implies a great number of useful crypto- graphic tools, including the cipher conjecture (i.e., the two conjectures are in fact equivalent). We start by showing that once we can get to an output that is one bit longer than the input, we can in fact obtain any polynomial number of bits.
Theorem 3.4 โ Length Extension for PRGโs. Suppose that the PRG con- jecture is true. Then for every polynomial ๐ก(๐), there exists a pseu- dorandom generator mapping ๐ bits to ๐ก(๐) bits.
Figure 3.2 : Length extension for pseudorandom generators
Proof. The proof of this theorem is very similar to the length extension theorem for ciphers, and in fact this theorem can be used to give an alternative proof for the former theorem. The construction is illustrated in Fig. 3.2. We are given a pseu- dorandom generator ๐บโฒ^ mapping ๐ bits into ๐ + 1 bits and need to construct a pseudorandom generator ๐บ mapping ๐ bits to ๐ก = ๐ก(๐) bits for some polynomial ๐ก(โ ). The idea is that we maintain a state of ๐ bits, which are originally our input seed^5 ๐ 0 , and at the ๐๐กโ^ step we use ๐บโฒ to map ๐ ๐โ1 to the ๐ + 1-long bit string (๐ ๐, ๐ฆ๐), output ๐ฆ๐ and keep ๐ ๐ as our new state. To prove the security of this construction we need to show that the distribution ๐บ(๐๐) = (๐ฆ 1 , โฆ , ๐ฆ๐ก) is computationally indistinguishable from the uniform distribution ๐๐ก. As usual, we will use the hybrid argument. For ๐ โ {0, โฆ , ๐ก} we define ๐ป๐ to be the dis- tribution where the first ๐ bits chosen uniformly at random, whereas the last ๐ก โ ๐ bits are computed as above. Namely, we choose ๐ ๐ at ran-
pseudorandomness 95
dom in {0, 1}๐^ and continue the computation of ๐ฆ๐+1, โฆ , ๐ฆ๐ก from the state ๐ ๐. Clearly ๐ป 0 = ๐บ(๐๐) and ๐ป๐ก = ๐๐ก and hence by the triangle inequality it suffices to prove that ๐ป๐ โ ๐ป๐+1 for all ๐ โ {0, โฆ , ๐ก โ 1}. We illustrate these two hybrids in Fig. 3.3.
Figure 3.3 : Hybrids ๐ป๐ and ๐ป๐+1โ dotted boxes refer to values that are chosen independently and uniformly at random
Now suppose otherwise that there exists some adversary ๐ธ๐ฃ๐ such that |๐ผ[๐ธ๐ฃ๐(๐ป๐)] โ ๐ผ[๐ธ๐ฃ๐(๐ป๐+1)]| โฅ ๐ for some non-negligible ๐. From ๐ธ๐ฃ๐, we will design an adversary ๐ธ๐ฃ๐โฒ^ breaking the security of the pseudorandom generator ๐บโฒ^ (see Fig. 3.4).
Figure 3.4 : Building an adversary ๐ธ๐ฃ๐โฒ^ for ๐บโฒ^ from an adversary ๐ธ๐ฃ๐ distinguishing ๐ป๐ and ๐ป๐+1. The boxes marked with questions marks are those that are random or pseudorandom depending on whether we are in ๐ป๐ or ๐ป๐+1. Everything inside the dashed red lines is simulated by ๐ธ๐ฃ๐โฒ^ that gets as input the ๐ + 1-bit string (๐ ๐+1, ๐ฆ๐+1).
On input a string ๐ฆ of length ๐ + 1, ๐ธ๐ฃ๐โฒ^ will interpret ๐ฆ as (๐ ๐+1, ๐ฆ๐+1) where ๐ ๐+1 โ {0, 1}๐. She then chooses ๐ฆ 1 , โฆ , ๐ฆ๐ randomly and compute ๐ฆ๐+2, โฆ , ๐ฆ๐ก as in our pseudorandom generatorโs construc- tion. ๐ธ๐ฃ๐โฒ^ will then feed (๐ฆ 1 , โฆ , ๐ฆ๐ก) to ๐ธ๐ฃ๐ and output whatever ๐ธ๐ฃ๐
pseudorandomness 97
cuit can predict the next bit of the output of ๐บ given the previous bits significantly better than guessing.
We now show that the condition for a function ๐บ to be unpre- dictable is equivalent to the condition for it to be a secure PRG. Please make sure you follow the proof, because it is an important theorem, and because it is another example of a canonical cryptographic proof.
Lemma 3.7 Let ๐บ โถ {0, 1}โ^ โ {0, 1}โ^ be a function with length function โ(๐), then ๐บ is a secure PRG iff it is unpredictable.
Proof. For the forward direction, suppose for contradiction that there exists some ๐ and some circuit ๐ can predict ๐ฆ๐ given ๐ฆ 1 , โฆ , ๐ฆ๐โ1 with probability ๐ โฅ 12 + ๐(๐) for non-negligible ๐. Consider the adversary ๐ธ๐ฃ๐ that, given a string ๐ฆ, runs the circuit ๐ on ๐ฆ 1 , โฆ , ๐ฆ๐โ1, checks if the output is equal to ๐ฆ๐ and if so output 1. If ๐ฆ = ๐บ(๐ฅ) for a uniform ๐ฅ, then ๐ succeeds with probability ๐. If ๐ฆ is uniformly random, then we can imagine that the bit ๐ฆ๐ is generated after ๐ finished its calculation. The bit ๐ฆ๐ is 0 or 1 with equal probability, so ๐ succeeds with probability 12. Since ๐ธ๐ฃ๐ outputs 1 when ๐ succeeds,
|Pr[๐ธ๐ฃ๐(๐บ(๐๐)) = 1] โ Pr[๐ธ๐ฃ๐(๐โ) = 1]| = |๐ โ
a contradiction. For the backward direction, let ๐บ be an unpredictable function. Let ๐ป๐ be the distribution where the first ๐ bits come from ๐บ(๐๐) while the last โ โ ๐ bits are all random. Notice that ๐ป 0 = ๐โ and ๐ปโ = ๐บ(๐๐), so it suffices to show that ๐ป๐โ1 โ ๐ป๐ for all ๐. Suppose ๐ป๐โ1 โ ๐ป๐ for some ๐, i.e. there exists some ๐ธ๐ฃ๐ and non- negligible ๐ such that
Pr[๐ธ๐ฃ๐(๐ป๐) = 1] โ Pr[๐ธ๐ฃ๐(๐ป๐โ1) = 1] > ๐(๐).
Consider the program ๐ that, on input (๐ฆ 1 , โฆ , ๐ฆ๐โ1), picks the bits ๐ฆ๐ฬ, โฆ ,ฬ ๐ฆโ uniformly at random. Then, ๐ calls ๐ธ๐ฃ๐ on the generated input. If ๐ธ๐ฃ๐ outputs 1 then ๐ outputs ๐ฆ๐ฬ, and otherwise it outputs 1 โฬ ๐ฆ๐. The string (๐ฆ 1 , โฆ , ๐ฆ๐โ1,ฬ ๐ฆ๐, โฆ ,ฬ ๐ฆโ) has the same distribution as ๐ป๐โ1. However, conditioned on ๐ฆ๐ฬ = ๐ฆ๐, the string has distribution equal to ๐ป๐. Let ๐ be the probability that ๐ธ๐ฃ๐ outputs 1 if ๐ฆ๐ฬ = ๐ฆ๐ and ๐ be the same probability when ๐ฆฬ๐ โ ๐ฆ๐, then we get
๐ โ
2 (๐ + ๐) =^ Pr[๐ธ๐ฃ๐(๐ป๐) = 1] โ^ Pr[๐ธ๐ฃ๐(๐ป๐โ1) = 1] > ๐(๐).
Therefore, the probability ๐ outputs the correct value is equal to 12 ๐ + 1 2 (1 โ ๐) =^ 1 2 + ๐(๐), a contradiction. โ
98 an intensive introduction to cryptography
The definition of unpredictability is useful because many of our candidates for pseudorandom generators appeal to the unpredictabil- ity definition in their proofs. For example, the Blum-Blum-Shub gen- erator we will see later in the chapter is proved to be unpredictable if the โquadratic residuosity problemโ is hard. It is also nice to know that our intuition at the beginning of the chapter can be formalized.
3.1 STREAM CIPHERS
We now show a connection between pseudorandom generators and encryption schemes:
Theorem 3.8 โ PRG conjecture implies Cipher conjectures. If the PRG conjecture is true then so is the cipher conjecture.
It turns out that the converse direction is also true, and hence these two conjectures are equivalent. We will probably not show the (quite non-trivial) proof of this fact in this course. (We might show a weaker version though.)
Proof. Recall that the one time pad is a perfectly secure cipher but its only problem was that to encrypt an ๐ + 1 long message it needed an ๐ + 1 long bit key. Now using a pseudorandom generator, we can map an ๐-bit long key into an ๐ + 1-bit long string that looks random enough that we could use it as a key for the one-time pad. That is, our cipher will look as follows:
and
Just like in the one time pad, ๐ท๐(๐ธ๐(๐)) = ๐บ(๐) โ ๐บ(๐) โ ๐ = ๐. Moreover, the encryption and decryption algorithms are clearly efficient. We will prove security of this encryption by showing the stronger claim that ๐ธ๐๐ (๐) โ ๐๐+1 for any ๐. Notice that ๐๐+1 = ๐๐+1 โ ๐, as we showed in the security of the one-time pad. Suppose that for some non-negligible ๐ = ๐(๐) > 0 there is an efficient adversary ๐ธ๐ฃ๐โฒ^ such that
Then the adversary ๐ธ๐ฃ๐ defined as ๐ธ๐ฃ๐(๐ฆ) = ๐ธ๐ฃ๐โฒ(๐ฆ โ ๐) would be also efficient. Furthermore, if ๐ฆ is pseudorandom then ๐ธ๐ฃ๐(๐ฆ) = ๐ธ๐ฃ๐โฒ(๐บ(๐๐) โ ๐) and if ๐ฆ is uniformly random then ๐ธ๐ฃ๐(๐ฆ) =
100 an intensive introduction to cryptography
(^6) CRC are often used to generate a โcontrol digitโ to detect mistypes of credit card or social security card number. This has very different goals than its use for pseudorandom generators, though there are some common intuitions behind the two usages.
3.2 WHAT DO PSEUDORANDOM GENERATORS ACTUALLY LOOK LIKE?
So far we have made the conjectures that objects such as ciphers and pseudorandom generators exist , without giving any hint as to how they would actually look like. (Though we have examples such as the Caesar cipher, Vigenere, and Enigma of what secure ciphers donโt look like.) As mentioned above, we do not know how to prove that any particular function is a pseudorandom generator. However, there are quite simple candidates (i.e., functions that are conjectured to be secure pseudorandom generators), though care must be taken in constructing them. We now consider candidates for functions that maps ๐ bits to ๐ + 1 bits (or more generally ๐ + ๐ for some constant ๐ ) and look at least somewhat โrandomishโ. As these constructions are typically used as a basic component for obtaining a longer length PRG via the length extension theorem (Theorem 3.4), we will think of these pseudorandom generators as mapping a string ๐ โ {0, 1}๐ representing the current state into a string ๐ โ โ {0, 1}๐^ representing the new state as well as a string ๐ โ {0, 1}๐^ representing the current output. See also Section 6.1 in Katz-Lindell and (for greater depth) Sections 3.6-3.9 in the Boneh-Shoup book.
3.2.1 Attempt 0: The counter generator To get started, letโs look at an example of an obviously bogus pseudo- random generator. We define the โcounter pseudorandom generatorโ ๐บ โถ {0, 1}๐^ โ {0, 1}๐+1^ as follows. ๐บ(๐ ) = (๐ โฒ, ๐) where ๐ โฒ^ = ๐ + 1 mod 2 ๐^ (treating ๐ and ๐ โฒ^ as numbers in {0, โฆ , 2๐^ โ 1}) and ๐ is the least significant digit of ๐ โฒ. Itโs a great exercise to work out why this is not a secure pseudorandom generator.
P You should really pause here and make sure you see why the โcounter pseudorandom generatorโ is not a secure pseudorandom generator. Show that this is true even if we replace the least significant digit by the ๐-th digit for every 0 โค ๐ < ๐.
3.2.2 Attempt 1: The linear checksum / linear feedback shift register (LFSR) LFSR can be thought of as the โmotherโ (or maybe more like the sick great-uncle) of all pseudorandom generators. One of the simplest ways to generate a โrandomishโ extra digit given an ๐ digit number is to use a checksum - some linear combination of the digits, with a canonical example being the cyclic redundancy check or CRC.^6 This motivates the notion of a linear feedback shift register generator (LFSR):
pseudorandomness 101
(^7) A ring is a set of elements where addition and multiplication are defined and obey the natural rules of associativity and commutativity (though without necessarily having a multiplicative inverse for every element). For every integer ๐ we define โค๐ (known as the ring of integers modulo ๐) to be the set {0, โฆ , ๐ โ 1} where addition and multiplication is done modulo ๐.
(^8) Despite the name, the algorithm goes at least as far back as the Chinese Jiuzhang Suanshu manuscript, circa 150 B.C.
if the current state is ๐ โ {0, 1}๐^ then the output is ๐(๐ ) where ๐ is a linear function (modulo 2) and the new state is obtained by right shifting the previous state and putting ๐(๐ ) at the leftmost location. That is, ๐ โฒ 1 = ๐(๐ ) and ๐ โฒ๐ = ๐ ๐โ1 for ๐ โ {2, โฆ , ๐}. LFSRโs have several good properties- if the function ๐(โ ) is chosen properly then they can have very long periods (i.e., it can take an ex- ponential number of steps until the state repeats itself), though that also holds for the simple โcounterโ generator we saw above. They also have the property that every individual bit is equal to 0 or 1 with probability exactly half (the counter generator also shares this prop- erty). A more interesting property is that (if the function is selected prop- erly) every two coordinates are independent from one another. That is, there is some super-polynomial function ๐ก(๐) (in fact ๐ก(๐) can be exponential in ๐) such that if โ โ โโฒ^ โ {0, โฆ , ๐ก(๐)}, then if we look at the two random variables corresponding to the โ-th and โโฒ-th output of the generator (where randomness is the initial state) then they are distributed like two independent random coins. (This is non-trivial to show, and depends on the choice of ๐ - it is a challenging but useful exercise to work this out.) The counter generator fails badly at this condition: the least significant bits between two consecutive states always flip. There is a more general notion of a linear generator where the new state can be any invertible linear transformation of the previous state. That is, we interpret the state ๐ as an element of โค๐ก๐ for some integers ๐, ๐ก,^7 and let ๐ โ = ๐น (๐ ) and the output ๐ = ๐บ(๐ ) where ๐น โถ โค๐ก๐ โ โค๐ก๐ and ๐บ โถ โค๐ก๐ โ โค๐ are invertible linear transformations (modulo ๐). This includes as a special case the linear congruential generator where ๐ก = 1 and the map ๐น (๐ ) corresponds to taking ๐๐ (mod ๐) where ๐ is number co-prime to ๐. All these generators are unfortunately insecure due to the great bane of cryptography- the Gaussian elimination algorithm which stu- dents typically encounter in any linear algebra class.^8
Theorem 3.10 โ The unfortunate theorem for cryptography. There is a poly- nomial time algorithm to solve ๐ linear equations in ๐ variables (or to certify no solution exists) over any ring.
Despite its seeming simplicity and ubiquity, Gaussian elimination (and some generalizations and related algorithms such as Euclidโs extended g.c.d algorithm and the LLL lattice reduction algorithm) has been used time and again to break candidate cryptographic con- structions. In particular, if we look at the first ๐ outputs of a linear generator ๐ 1 , โฆ , ๐๐ then we can write linear equations in the unknown
pseudorandomness 103
Easy Hard Convex Non-convex Linear Non-linear (degree โฅ 2) Noiseless Noisy Local Global Shallow Deep Low degree High degree
Many cryptographic constructions can be thought of as trying to transform an easy problem into a hard one by moving from the left to the right column of this table. The discrete logarithm problem is the discrete version of the con- tinuous real logarithm problem. The learning with errors problem can be thought of as the noisy version of the linear equations problem (or the discrete version of least squares minimization). When con- structing block ciphers we often have mixing transformation to ensure that the dependency structure between different bits is global , S-boxes to ensure non-linearity , and many rounds to ensure deep structure and large algebraic degree. This also works in the other direction. Many algorithmic and ma- chine learning advances work by embedding a discrete problem in a continuous convex one. Some attacks on cryptographic objects can be thought of as trying to recover some of the structure (e.g., by embed- ding modular arithmetic in the real line or โlinearizingโ non linear equations).
3.2.4 Attempt 2: Linear Congruential Generators with dropped bits One approach that is widely used in implementations of pseudoran- dom generators is to take a linear generator such as the linear congru- ential generators described above, and use for the output a โchoppedโ version of the linear function and drop some of the least significant bits. The operation of dropping these bits is non-linear and hence the attack above does not immediately apply. Nevertheless, it turns out this attack can be generalized to handle this case, and hence even with dropped bits Linear Congruential Generators are completely insecure and should be used (if at all) only in applications such as simulations where there is no adversary. Section 3.7.1 in the Boneh-Shoup book describes one attack against such generators that uses the notion of lattice algorithms that we will encounter later in this course in very different contexts.
104 an intensive introduction to cryptography
(^10) Actually modern computers will be able to break this generator via brute force, but if the length and number of the constants were doubled (or perhaps quadrupled) this should be sufficiently secure, though longer to write down.
3.3 SUCCESSFUL EXAMPLES
Letโs now describe some successful (at least per current knowledge) pseudorandom generators:
3.3.1 Case Study 1: Subset Sum Generator Here is an extremely simple generator that is yet still secure^10 as far as we know.
_# seed is a list of 40 zero/one values
def subset_sum_gen(seed): modulo = 0x constants = [ 0x3D6EA1, 0x1E2795, 0xC802C6, 0xBF742A, 0x45FF31, 0x53A9D4, 0x927F9F, 0x70E09D, 0x56F00A, 0x78B494, 0x9122E7, 0xAFB10C, 0x18C2C8, 0x8FF050, 0x0239A3, 0x02E4E0, 0x779B76, 0x1C4FC2, 0x7C5150, 0x81E05E, 0x154647, 0xB80E68, 0xA042E5, 0xE20269, 0xD3B7F3, 0xCC5FB9, 0x0BFC55, 0x847AE0, 0x8CFDF8, 0xE304B7, 0x869ACE, 0xB4CDAB, 0xC8E31F, 0x00EDC7, 0xC50541, 0x0D6DDD, 0x695A2F, 0xA81062, 0x0123CA, 0xC6C5C3 ]
_# return the modular sum of the constants
return reduce( lambda x,y: (x+y) % modulo, map( lambda a,b: a*b, constants,seed))
The seed to this generator is an array seed of 40 bits, with 40 hard- wired constants each 48 bits long (these constants were generated at random, but are fixed once and for all, and are not kept secret and hence are not considered part of the secret random seed). The output is simply 40 โ ๐=
seed[๐]constants[๐] (mod 248 )
and hence expands the 40 bit input into a 48 bit output. This generator is loosely motivated by the โsubset sumโ computa- tional problem, which is NP hard. However, since NP hardness is a worst case notion of complexity, it does not imply security for pseudo- random generators, which requires hardness of an average case variant. To get some intuition for its security, we can work out why (given that it seems to be linear) we cannot break it by simply using Gaussian elimination.
106 an intensive introduction to cryptography
(^11) I typically do not include references in these lecture notes, and leave them to the texts, but I make here an exception because Itsik Mantin was a close friend of mine in grad school.
ized to zero, although to save on initial seed size, typically RC4 uses some โpseudorandomโ way to generate P from a shorter seed as well. RC4 has extremely efficient software implementations and hence has been widely implemented. However, it has several issues with its security. In particular it was shown by Mantin^11 and Shamir that the second bit of RC4 is not random, even if the initialization vector was random. This and other issues led to a practical attack on the 802.11b WiFi protocol, see Section 9.9 in Boneh-Shoup. The initial response to those attacks was to suggest to drop the first 1024 bytes of the output, but by now the attacks have been sufficiently extended that RC4 is simply not considered a secure cipher anymore. The ciphers Salsa and ChaCha, designed by Dan Bernstein, have a similar design to RC4, and are considered secure and deployed in several standard protocols such as TLS, SSH and QUIC, see Section 3.6 in Boneh-Shoup.
3.3.3 Case Study 3: Blum, Blum and Shub B.B.S., which stands for the authors Blum, Blum and Shub, is a simple generator constructed from a potentially hard problem in number theory. Let ๐ = ๐ โ ๐, where ๐ , ๐ are primes. (We will generally use ๐ , ๐ of size roughly ๐, where ๐ is our security parameter, and so use capital letters to emphasize that the magnitude of these numbers is exponential in the security parameter.) We define QR ๐ to be the set of quadratic residues modulo ๐ , which are the numbers that have a modular square root. Formally,
QR ๐ = {๐^2 mod ๐ โฃ gcd(๐, ๐ ) = 1}. This definition extends the concept of โperfect squaresโ when we are working with standard integers. Notice that each number in ๐ โ QR ๐ has at least one square root (number ๐ such that ๐ = ๐^2 mod ๐ ). We will see later in the course that if ๐ = ๐ โ ๐ for primes ๐ , ๐ then each ๐ โ QR ๐ has exactly 4 square roots. The B.B.S. genera- tor chooses ๐ = ๐ โ ๐, where ๐ , ๐ are prime and ๐ , ๐ โก 3 (mod 4). The second condition guarantees that for each ๐ โ QR ๐ , exactly one of its square roots fall in QR ๐ , and hence the map ๐ โฆ ๐^2 mod ๐ is one-to-one and onto map from QR ๐ to itself. It is defined as follows:
def BBS(X): return (X * X % N, N % 2)
In other words, on input ๐, BBS (๐) outputs ๐^2 mod ๐ and the least significant bit of ๐. We can think of BBS as a map BBS โถ ๐๐ ๐ โ QR ๐ ร {0, 1} and so it maps a domain into a larger domain. We can also extend it to output ๐ก additional bits, by repeatedly squaring the
pseudorandomness 107
(^12) There is a whole (highly recommended) book by Alon and Spencer devoted to this method.
input, letting ๐ 0 = ๐, ๐๐+1 = ๐๐^2 mod ๐ , for ๐ = 0, โฆ , ๐ก โ 1, and outputting ๐๐ก together with the least significant bits of ๐ 0 , โฆ , ๐๐กโ1. It turns out that assuming that there is no polynomial-time algorithm (where โpolynomial-timeโ means polynomial in the number of bits to represent ๐ , i.e., polynomial in log ๐ ) to factor randomly chosen integers ๐ = ๐ โ ๐, for every ๐ก that is polynomial in the number of bits in ๐ , the output of the ๐ก-step BBS generator will be computationally indistinguishable from ๐๐๐ ๐ ร ๐๐ก where ๐๐๐ ๐ denotes the uniform distribution over QR ๐. The number theory required to show takes a while to develop. However, it is interesting and I recommend the reader to search up this particular generator, see for example this survey by Junod.
3.4 NON-CONSTRUCTIVE EXISTENCE OF PSEUDORANDOM GEN- ERATORS
We now show that, if we donโt insist on constructivity of pseudoran- dom generators, then there exists pseudorandom generators with output that are exponentially larger than the input length.
Lemma 3.12 โ Existence of inefficient pseudorandom generators. There is some absolute constant ๐ถ such that for every ๐, ๐ , if โ > ๐ถ(log ๐ + log(1/๐)) and ๐ โค ๐ , then there is an (๐ , ๐) pseudorandom generator ๐บ โถ {0, 1}โ^ โ {0, 1}๐.
Proof Idea: The proof uses an extremely useful technique known as the โprob- abilistic methodโ which is not too hard mathematically but can be confusing at first.^12 The idea is to give a โnon constructiveโ proof of existence of the pseudorandom generator ๐บ by showing that if ๐บ was chosen at random, then the probability that it would be a valid (๐ , ๐) pseudorandom generator is positive. In particular this means that there exists a single ๐บ that is a valid (๐ , ๐) pseudorandom generator. The probabilistic method is just a proof technique to demonstrate the existence of such a function. Ultimately, our goal is to show the ex- istence of a deterministic function ๐บ that satisfies the conditions of a (๐ , ๐) PRG. โ
The above discussion might be rather abstract at this point, but would become clearer after seeing the proof.
Proof of Lemma 3.12. Let ๐, ๐ , โ, ๐ be as in the lemmaโs statement. We need to show that there exists a function ๐บ โถ {0, 1}โ^ โ {0, 1}๐^ that โfoolsโ every ๐ line program ๐ in the sense of (3.1). We will show that this follows from the following claim:
pseudorandomness 109
๐ โถ {0, 1}๐^ โ {0, 1}, if ๐ฟ > 2๐ถ(log^ ๐ +log(1/๐))^ (which by setting ๐ถ > 4, we can ensure is larger than 10๐ 2 /๐^2 ) then the probability that
๐ฟโ โ ๐=
๐ (๐ฆ๐) โ Pr ๐ โ๐ {0,1}๐
is at most 2 โ๐^2. ( ?? ) follows directly from the Chernoff bound. If we let for every ๐ โ [๐ฟ] the random variable ๐๐ denote ๐ (๐ฆ๐), then since ๐ฆ 0 , โฆ , ๐ฆ๐ฟโ1 is chosen independently at random, these are inde- pendently and identically distributed random variables with mean ๐ผ๐ฆโ๐ {0,1}๐ [๐ (๐ฆ)] = Pr๐ฆโ๐ {0,1}๐ [๐ (๐ฆ) = 1] and hence the probability that they deviate from their expectation by ๐ is at most 2 โ 2โ๐^2 ๐ฟ/2. โ