13.12.2012 Views

CAS CS 538. Solutions to Problem Set 3

CAS CS 538. Solutions to Problem Set 3

CAS CS 538. Solutions to Problem Set 3

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

BU <strong>CAS</strong> <strong>CS</strong> <strong>538.</strong> Fall 2012. 1<br />

<strong>Problem</strong> 1.<br />

(a)<br />

<strong>CAS</strong> <strong>CS</strong> <strong>538.</strong> <strong>Solutions</strong> <strong>to</strong> <strong>Problem</strong> <strong>Set</strong> 3<br />

∆(X, Y ) =<br />

=<br />

max | Pr[X ∈ T ] − Pr[Y ∈ T ]|<br />

T<br />

�<br />

� n� � 1<br />

max � Pr[Xi ∈ T ] −<br />

T �n<br />

i=1<br />

1<br />

�<br />

n� �<br />

�<br />

Pr[Yi ∈ T ] �<br />

n<br />

�<br />

i=1<br />

≤ 1<br />

n max<br />

n�<br />

| Pr[Xi ∈ T ] − Pr[Yi ∈ T ]|<br />

T<br />

≤ 1<br />

n<br />

= 1<br />

n<br />

n�<br />

i=1<br />

i=1<br />

max | Pr[Xi ∈ T ] − Pr[Yi ∈ T ]|<br />

T<br />

n�<br />

∆(Xi, Yi) .<br />

i=1<br />

(b) We know that for any m0, m1 ∈ M,<br />

∆(Enck(m0), Enck(m1)) ≤ ɛ .<br />

Let the function f(x) be defined as f(x) = (m1, x). Applying this function <strong>to</strong> both random variables<br />

in the above inequality (which is allowed by <strong>Problem</strong> 2.5 from PS2), we get<br />

∆((m1, Enck(m0)), (m1, Enck(m1))) ≤ ɛ .<br />

The above holds for every message m1 ∈ M, so let us enumerate all the messages in M as msg 1, . . . ,<br />

msg |M|, and let Xi = (msg i, Enck(m0)) and Yi = (msg i, Enck(msg i)). The above formula simply says<br />

that ∆(Xi, Yi) ≤ ɛ.<br />

Note that choosing a random i and then the value of Xi gives us the distribution X = (m, Enck(m0)),<br />

and choosing a random i and then the value of Yi gives us the distribution Y = (m, Enck(m)). By<br />

the previous part, ∆(X, Y ) ≤ 1<br />

|M|<br />

� |M|<br />

i=1 ∆(Xi, Yi) ≤ ɛ.<br />

(c) Suppose |K| < |M|(1 − ɛ). We know from the previous part that if for all m0, m1 ∈ M,<br />

∆(Enck(m0), Enck(m1)) ≤ ɛ, then for all m0, ∆(X, Y ) ≤ ɛ, where X = (m, Enck(m0)) and Y =<br />

(m, Enck(m)). Consider the following set T : T = {(m, c) | m ∈ M and ∃k ′ s.t. Deck ′(c) = m}. Then<br />

Pr[X ∈ T ] = Pr<br />

k∈K,m∈M [∃k′ s.t. Deck ′(Enck(m0)) = m] .<br />

For any k, because there are at most |M|(1 − ɛ) different values for k ′ , the result of Deck ′(Enck(m0))<br />

can take on fewer than |M|(1 − ɛ) different values. The chances that a random m ∈ M is one of<br />

those are therefore less than |M|(1−ɛ)<br />

= 1 − ɛ. Since this holds for every k, it also holds for a random<br />

|M|<br />

k, hence Pr[X ∈ T ] < 1 − ɛ. On the other hand, Pr[Y ∈ T ] = 1 (simply take k ′ = k; by correctness<br />

of encryption, Deck ′(Enck(m)) = m). So ∆(X, Y ) > |1 − ɛ − 1| = ɛ, which contradicts the previous<br />

part.


BU <strong>CAS</strong> <strong>CS</strong> <strong>538.</strong> Fall 2012. 2<br />

<strong>Problem</strong> 2.<br />

(a) Suppose for contradiction that ¯ G is not a pseudorandom genera<strong>to</strong>r. Then there must be a<br />

polynomial time distinguisher Ā that with nonnegligible probability distinguishes outputs of ¯ G versus<br />

random strings. In other words,<br />

|Prs∈{0,1} k[ Ā( ¯ G(s)) = 1] − Prr∈{0,1} | ¯ G(0k )|[ Ā(r) = 1]| = f(k),<br />

where f is some nonnegligible function. We can now build A, a polynomial time distinguisher for G<br />

that on input x works as follows:<br />

• let ¯x be x with bits negated (¯xi = 1 − xi)<br />

• run Ā(¯x) and output whatever it does.<br />

The probability that A distinguishes outputs of G on random seeds with length k versus random<br />

strings, is exactly f(k). To see that, notice that:<br />

1. if A is given x = G(s) for random s ∈ {0, 1} k , then ¯x = ¯ G(s), and so Pr[ Ā( ¯ G(s)) = 1] =<br />

Pr[A(G(s)) = 1]<br />

2. if x is a randomly chosen string, then ¯x is a randomly chosen string <strong>to</strong>o, and so Pr[A(x) = 1] =<br />

Pr[ Ā(x) = 1].<br />

This confirms that<br />

|Pr s∈{0,1} k[A(G(s)) = 1] − Pr r∈{0,1} |G(0 k )|[A(r) = 1]| = f(k),<br />

which contradicts the pseudorandomness of G.<br />

(b) We can construct a counterexample. Let G1 be an arbitrary pseudorandom genera<strong>to</strong>r, and<br />

G2 = ¯ G1 (G2(s) outputs G1(s) but with each bit negated). As we saw in the previous problem, G2<br />

is a pseudorandom genera<strong>to</strong>r <strong>to</strong>o. But G3(s) = G1(s) ◦ ¯ G1(s) can be <strong>to</strong>ld apart from random, and<br />

here is a distinguisher (with input x):<br />

• let l = |x|<br />

• if x1 = xl/2+1 then output 0 else output 1 .<br />

When given G3(s), this distinguisher always outputs 1, because the first bit of G3(s) is always the<br />

negation of the (l/2 + 1)-st one. But when given a random string, the distinguisher outputs either<br />

1 or 0 with probability 1/2, because there is exactly 1/2 chance that the first and the (l/2 + 1)-st<br />

bits are equal. So we have a 1/2 probability of distinguishing outputs of G3 versus random, which is<br />

nonnegligible.<br />

<strong>Problem</strong> 3.<br />

(a) (First solution)<br />

We define experiments exp 0, exp 1 and exp 2.<br />

exp i(k) :


BU <strong>CAS</strong> <strong>CS</strong> <strong>538.</strong> Fall 2012. 3<br />

• generate random k-bit strings s1 and s2<br />

• generate random strings r1 and r2 of lengths |G1(0 k )| and |G2(0 k )| respectively<br />

• output A(r1 ◦ r2) or A(G1(s1) ◦ r2) or A(G1(s1) ◦ G2(s2)) depending on whether i is 0, 1 or 2,<br />

respectively .<br />

Notice that exp 0 describes the run of the distinguisher A on a random string, exp 2 on a pseudorandom<br />

string output by G3, and exp 1 on a hybrid. To prove that G3 is a pseudorandom genera<strong>to</strong>r, we need<br />

<strong>to</strong> make sure that f(k) = |Pr[exp 0(k) = 1] − Pr[exp 2(k) = 1]| is negligible.<br />

Let f1(k) = |Pr[exp 0(k) = 1] − Pr[exp 1(k) = 1]| and f2(k) = |Pr[exp 1(k) = 1] − Pr[exp 2(k) = 1]|.<br />

By triangle inequality, f(k) ≤ f1(k)+f2(k). We now need <strong>to</strong> prove that both f1 and f2 are negligible.<br />

Each proof will be done by contradiction:<br />

1. If f1(k) = |Pr[exp 0(k) = 1] − Pr[exp 1(k) = 1]| were nonnegligible then we could construct A1<br />

that breaks G1 on seeds of length k ∈ K: A1(y) simply calls A(y ◦r) where r is a random string<br />

of length |G2(0 k )|; y ◦ r is distributed either as in exp 0, or as in exp 1, depending on whether y<br />

is random or output by G1, so A1 “works” with probability at least f1(k). Contradiction!<br />

2. If f2(k) = |Pr[exp 1(k) = 1] − Pr[exp 2(k) = 1]| were nonnegligible then we could construct A2<br />

that breaks G2 on seeds of length k ∈ K: A2(y) calls A(G1(s) ◦ y) for a random s ∈ {0, 1} k ;<br />

depending on whether y is random or output by G2, the distribution of G1(s) ◦ y is either as in<br />

exp 1 or as in exp 2; here it is important <strong>to</strong> note that s is indeed chosen independently of y. We<br />

conclude that A2 “works” with probability at least f2(k). Contradiction!<br />

(b) (Alternate solution)<br />

The first solution was based on the indistinguishability definition of a pseudorandom genera<strong>to</strong>r. This<br />

one employs the next-bit unpredictability definition.<br />

Suppose for contradiction that there exists A, a polynomial time next-bit predic<strong>to</strong>r for G3 with<br />

nonnegligible predicting probability. Consider the predicting experiment exp(k):<br />

• select random s ∈ {0, 1} k and compute y = G3(s)<br />

• call A(1 k ) giving it bits of y as answers <strong>to</strong> its next requests<br />

• output whatever A does .<br />

Recall that we say that exp succeeds if its output after i stages is equal <strong>to</strong> yi. By our assumption,<br />

we have that Pr[exp(k) succeeds] = f(k) for some nonnegligible function f. Now let l(k) be the<br />

length of G1(0 k ). If exp(k) succeeds, then it either succeeds after i < l(k) or i ≥ l(k) stages. So<br />

Pr[exp(k) succeeds] = Pr[exp(k) succeeds after < l(k) st.] + Pr[exp(k) succeeds after ≥ l(k) st.].<br />

Let f1(k) = Pr[exp(k) succeeds after < l(k) st.] and f2(k) = Pr[exp(k) succeeds after ≥ l(k) st.].<br />

Since f(k) = f1(k) + f2(k) is nonnegligible, then at least one of f1, f2 must be nonnegligible <strong>to</strong>o.<br />

Suppose f1 is nonnegligible. Then we can build A1, a predic<strong>to</strong>r for G1. A1(k) simply does the<br />

same as A(2k), and outputs whatever A(2k) does. The only difference is that in case A(2k) makes<br />

<strong>to</strong>o many (more than l(k)) next requests, A1 just outputs zero and terminates. A1(k) predicts some<br />

bit of G1’s output with probability f1(2k). Contradiction!


BU <strong>CAS</strong> <strong>CS</strong> <strong>538.</strong> Fall 2012. 4<br />

If, on the other hand, f2 is nonnegligible, then we build A2, a predic<strong>to</strong>r for G2. A2(k) first<br />

computes y = G1(s) for random s ∈ {0, 1} k . Then it calls A(2k), and answers its first l(k) next<br />

requests with bits of y. Subsequent A’s next requests are just relayed (A2 makes its own next request<br />

and forwards the answer <strong>to</strong> A). Finally, A2 outputs whatever A does. Again, A2(k) predicts some bit<br />

of G2’s output with probability f2(2k) (as in the first solution, the independence of seeds is crucial<br />

here: A2 choses s independently of y, which ensures the distribution of answers <strong>to</strong> next requests is<br />

the right one). Again a contradiction!<br />

Note that, even though at least one of A1, A2 succeeds in predicting bits of a corresponding<br />

genera<strong>to</strong>r, we do not know which one is it. Still this is a contradiction, <strong>to</strong> the statement “both G1<br />

and G2 are pseudorandom genera<strong>to</strong>rs”.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!