Docsity

Computational Indistinguishability - Introduction to Cryptography - Lecture Notes, Study notes of Cryptography and System Security

Toggle sidebar
bg1
Lecture 4 - Computational Indistinguishability, Pseudorandom
Generators
Boaz Barak
September 27, 2007
Computational Indistinguishability Recall that we defined that statistical distance of two dis-
tributions Xand Yover {0,1}nis at most if
Pr[A(X) = 1] −Pr[A(Y) = 1]
≤(*)
for every A:{0,1}n→ {0,1}.
We will say that Xand Yare computationally indistinguishable if (*) holds for every
polynomial-time Aand polynomially bounded . More formally, we need to use asymptotic
notation and so make the following definition:
Definition 1. Let {Xn},{Yn}be sequences of distributions with Xn, Ynranging over {0,1}`(n)
for some `(n) = nO(1).{Xn}and {Yn}are computationally indistinguishable (notation:
Xn≈Yn) if for every polynomial-time Aand polynomially-bounded , and sufficiently large
n
Pr[A(Xn) = 1] −Pr[A(Yn) = 1]
≤(n)
(If we want to nitpick, we’d give 1nas additional input to Ato ensure it can run in poly(n)-
time even if `(n) is much smaller than n.)
We will often drop the subscript nwhen it’s clear from the context. So, we’ll say that two
distributions Xand Yare computationally indistinguishable when we really mean that they
are part of two computationally indistinguishable sequences.
Some properties of computational indistinguishability: (Exercise)
•Obviously, if Xn≈Ynthen Yn≈Xn(i.e., ≈is symmetric).
•It’s weaker than statistical indistinguishability: if ∆(Xn, Yn)≤(n) for (n) = n−ω(1)
then Xn≈Yn. In particular, if Xn≡Ynthen Xn≈Yn(i.e., ≈is reflexive).
•It satisfies transitivity / triangle inequality: if Xn≈Ynand Yn≈Znthen Xn≈Zn
(i.e., ≈is transitive and hence is an equivalence relation).
•If Xn≈Ynand fis a polynomial time computable function then f(Xn)≈f(Yn).
•If Xn≈Ynthen for every m<n, the truncation of Xnto the first mbits is indistin-
guishable from the truncation of Ynto the first mbits.
Proof of transitivity condition The way is to simply express Pr[A(X) = 1] −Pr[A(Z) = 1] as
Pr[A(X) = 1] −Pr[A(Y) = 1] + Pr[A(Y) = 1] −Pr[A(Z) = 1], and then use the standard
triangle inequality |a+b|≤|a|+|b|to conclude that if both |Pr[A(X) = 1]−Pr[A(Y) = 1]| ≤
and |Pr[A(Y) = 1] −Pr[A(Z) = 1]| ≤ , then |Pr[A(X) = 1] −Pr[A(Z) = 1]| ≤ 2.
1
pf3
pf4
pf5

Partial preview of the text

Download Computational Indistinguishability - Introduction to Cryptography - Lecture Notes and more Study notes Cryptography and System Security in PDF only on Docsity!

Lecture 4 - Computational Indistinguishability, Pseudorandom

Generators

Boaz Barak

September 27, 2007

Computational Indistinguishability Recall that we defined that statistical distance of two dis- tributions X and Y over { 0 , 1 }n^ is at most  if ∣∣ Pr[A(X) = 1] − Pr[A(Y ) = 1]

for every A : { 0 , 1 }n^ → { 0 , 1 }. We will say that X and Y are computationally indistinguishable if (*) holds for every polynomial-time A and polynomially bounded . More formally, we need to use asymptotic notation and so make the following definition: Definition 1. Let {Xn}, {Yn} be sequences of distributions with Xn, Yn ranging over { 0 , 1 }(n) for some(n) = nO(1). {Xn} and {Yn} are computationally indistinguishable (notation: Xn ≈ Yn) if for every polynomial-time A and polynomially-bounded , and sufficiently large n (^) ∣ ∣Pr[A(Xn) = 1] − Pr[A(Yn) = 1]∣∣ (^) ≤ (n)

(If we want to nitpick, we’d give 1n^ as additional input to A to ensure it can run in poly(n)- time even if `(n) is much smaller than n.)

We will often drop the subscript n when it’s clear from the context. So, we’ll say that two distributions X and Y are computationally indistinguishable when we really mean that they are part of two computationally indistinguishable sequences. Some properties of computational indistinguishability: (Exercise)

  • Obviously, if Xn ≈ Yn then Yn ≈ Xn (i.e., ≈ is symmetric).
  • It’s weaker than statistical indistinguishability: if ∆(Xn, Yn) ≤ (n) for (n) = n−ω(1) then Xn ≈ Yn. In particular, if Xn ≡ Yn then Xn ≈ Yn (i.e., ≈ is reflexive).
  • It satisfies transitivity / triangle inequality: if Xn ≈ Yn and Yn ≈ Zn then Xn ≈ Zn (i.e., ≈ is transitive and hence is an equivalence relation).
  • If Xn ≈ Yn and f is a polynomial time computable function then f (Xn) ≈ f (Yn).
  • If Xn ≈ Yn then for every m < n, the truncation of Xn to the first m bits is indistin- guishable from the truncation of Yn to the first m bits.

Proof of transitivity condition The way is to simply express Pr[A(X) = 1] − Pr[A(Z) = 1] as Pr[A(X) = 1] − Pr[A(Y ) = 1] + Pr[A(Y ) = 1] − Pr[A(Z) = 1], and then use the standard triangle inequality |a+b| ≤ |a|+|b| to conclude that if both | Pr[A(X) = 1]−Pr[A(Y ) = 1]| ≤  and | Pr[A(Y ) = 1] − Pr[A(Z) = 1]| ≤ , then | Pr[A(X) = 1] − Pr[A(Z) = 1]| ≤ 2 .

Polynomial transitivity / hybrid argument We can generalize this proof to say that if we have a polynomial number m of distributions X^1 , X^2 ,... , Xm^ such that Xi ≈ Xi+1^ for every i, then X^1 ≈ Xm: Simply express Pr[A(X^1 ) = 1] − Pr[A(Xm) = 1] as

Pr[A(X^1 ) = 1]−Pr[A(X^2 ) = 1]+Pr[A(X^2 ) = 1]−Pr[A(X^3 ) = 1]+· · ·+Pr[A(Xm−^1 ) = 1]−Pr[A(Xm) = 1]

and conclude using the triangle inequality (|

∑m i=1 ai| ≤^

∑m i=1 |ai|) that if^ |^ Pr[A(X i) = 1] − Pr[A(Xi+1) = 1]| ≤  for every i, then | Pr[A(X^1 ) = 1] − Pr[A(Xm) = 1]| ≤ m.

Security def in these notation For example, recall that last time we made the following defi- nition: Definition Let (E, D) be an encryption scheme that uses n-bit keys to encrypt (n)-length messages. (E, D) is computationally secure if for every polynomial-time algorithm A : { 0 , 1 }∗^ → { 0 , 1 }, polynomially bounded  : { 0 , 1 }∗^ → [0, 1], n, and x 0 , x 1 ∈ { 0 , 1 }(n), ∣ ∣Pr[A(EUn (x 0 )) = 1] − Pr[A(EUn (x 1 ) = 1]

∣ (^) < (n)

An equivalent way to say this is that (E, D) is computationally secure if EUn (x 0 ) ≈ EUn (x 1 ) for every two messages x 0 , x 1.^1

Pseudorandomness We say that a distribution {Xn} is pseudorandom if it’s computationally indistinguishable from the uniform distribution.

Definition 2. A polynomial-time-computable deterministic function G mapping n bit strings into (n) bit strings for(n) ≥ n is called a pseudorandom generator if G(Un) ≈ U(n). The function(n) is called the stretch of the pseudorandom generator.

It’s trivial to construct a pseudorandom generator with (n) = n. Also, because of the trun- cation property, a pseudorandom generator with stretch(n) trivially yields a pseudoarndom generator with stretch ′(n) for every′(n) < (n). We are now ready to state our axiom: The PRG Axiom: There exists a pseudorandom generator with stretch(n) = n + 1. Our main Theorem for today will be Main Theorem: If the PRG Axiom is true then for every constant c, there exists a compu- tationally secure encryption scheme with message length `(n) = nc. It will follow from the following two theorems:

Theorem 1. If there exists a pseudorandom generator with stretch (n) = n + 1 then for every constant c, there exists a pseudorandom generator with stretch(n) = nc.

Theorem 2. If there exists a pseudorandom generator with stretch (n) then there exists a computationally secure encryption scheme with message length(n).

Proof of Theorem 2 There is a pretty natural construction of a private key encryption with key length < message length using a pseudorandom generator. Let G be the pseudorandom generator mapping n bit strings to (n) bit strings. (^1) More formally we’d say that for every two sequences of messages {xn 0 } and {xn 1 }, where xn 0 , xn 1 ∈ { 0 , 1 }(n), the two sequences {EUn (xn 0 )} and {EUn (xn 1 )} are computationally indistinguishable.

x

Gn Gn

Gn

x(1)

x(1) n+

x(2)

x(2) n+

xp(n)

xp n(+1n)

Output:

Figure 1: Extending output of pseudorandom genertator

j ← 0 x(0)^ ← x while j < `(n): y ← pmG(x(j−1)) x(j+1)^ ← y[1..n] output yn+ j ← j + 1

Note that Y (0)^ = G(Un) and Y (m)^ = Um. Therefore, the result will follow by showing that Y (0)^ ≈ Y (m). By the transitivity of computational indistinguishability, it suffices to prove: Claim 2.2. For every i ∈ [m], Y (i)^ ≈ Y (i+1)

Proof. Note that Y (i)^ = UiGm−i(Un) and Y (i+1)^ = Ui+1Gm−i−^1 (Un). Both start with i random bits and so it suffices to show that X = G(m−i)(Un) ≈ Y = U 1 G(m−i−1)(Un). Define f : { 0 , 1 }n+1^ → { 0 , 1 }m−i^ as follows: f (y) = yn+1G(m−i−1)(y[1..n]). Note that:

  • X = f (pmG(Un)).
  • Y = f (Un+1). But since pmG(Un) ≈ Un+1, it follows that f (pmG(Un)) ≈ f (Un+1) for every polynomial-time computable function f.

Note: This proof technique — proving that two distributions X and Y are indistinguishable by presenting intermediate distributions X(0),... , X(m)^ with X(0)^ = X and X(m)^ = Y and the showing that X(i)^ is indistinguishable from X(i+1)^ — is called the hybrid technique, and is a very important technique in cryptographic proofs. I recommend that you also review this proof in Section 6.4.2 of the Katz-Lindell book.

Candidates for pseudorandom generators: One justification to The PRG Axiom is that can- didate functions that we conjecture to be pseudorandom generators (even if we can’t prove it). Below are two such candidate functions. We’ll see more such candidates later on in the course.

RC4 RC4 was invented by Ron Rivest for RSA. Its design is a trade secret and so the actual algorithm is not supposed to be known (security by obscurity). Nevertheless the code was obtained by reverse engineering and leaked to the cyberpunks mailing list. Even though RC is widely used including in the WEP and WPA protocols for wireless networks (IEEE 802.11) and the SSL protocol, several weaknesses were found in it and so it can not be considered a secure pseudorandom generator. (And so in fact it’s not a good candidate, however I present it here since it is widely used and illustrates principles that are utilized in more secure candidates for pseudorandom generators.) A byte is a number from 0 to 255 (or equivalently, a string in { 0 , 1 }^8 ). The input to the pseudorandom generator is a permutation S : Z 256 → Z 256 (i.e., a 256 long array S[] such that S[i] 6 =S[j] for every i 6 =j). The output is m bytes (where we can control the value of m to be as large as we want). The following is the pseudocode for RC4:

i := 0 j := 0 num_outputted = 0; while num_outputted < m: i := (i + 1) mod 256 j := (j + S[i]) mod 256 swap(S[i],S[j]) num_outputted := num_outputted + 1 output S[(S[i] + S[j]) mod 256]

We see that RC4 expands log(256!) bits which is roughly 8 · 256 = 2048 bits into an arbitrary large m number of bits. However, in most current applications people desire an input much smaller than 2048 and so there’s a separate pseudorandom generator (called the key scheduling algorithm or KSA) that takes an input of size bits, for 40 ≤ ≤ 128, and outputs an initial permutation S. The page http://www.wisdom.weizmann.ac.il/~itsik/RC4/rc4. html (written by my friend Itsik Mantin) is a good source of information on RC4 and the attacks on it.

Blum-Blum-Shub The Blum-Blum-Shub generator is even simpler than RC4 but it is much less efficient. However it has the advantage that we can relate its security to a well known problem. Assuming factoring a random n bit integer^2 cannot be done in polynomial-time with polynomially-bounded success probability, this pseudorandom generator will be secure. The input is a number N (of length n bits) and X where 1 ≤ X < N.^3 The output will be m bits where again we can choose m to be as large as we want. The pseudocode is as follows:

num_outputted = 0; while num_outputted < m: X := X*X mod N num_outputted := num_outputted + 1 output least-significant-bit(X) (^2) Random here means that we choose random primes p and q of length n/2 bits, where for technical reasons we require that their remainder modulu 4 is 3, and let n = p · q. (^3) Actually X should satisfy gcd(X, N ) = 1 but this will happen with overwhelmingly high probability for a random X.