Docsity

Cryptography Homework 2: Function Growth Rates and Primitivity Testing, Exercises of Cryptography and System Security

Toggle sidebar
bg1
COS 433/MAT 473 — Cryptography — Homework 2.
Due Wed Oct 2 (Print and hand in at the beginning of class).
Please type up your solutions using L
A
T
EX.
See course homepage for collaboration policy and late submissions.
Problem 1 (15pts) Arrange the following functions in increasing order of growth rate, so that for
two consecutive functions f(n), g(n)in your sequence, either f(n) = o(g(n)) or f(n) = Θ(g(n)).
Explain the relationships of all adjacent pairs of functions in your order. Assume here that log is a
logarithm to base 2 and ln is a logarithm to base e.
n!,log n, (log n)n, n7,ln n, log(n4),n
7,2log n,2ln2n, nn, n(log n).
Problem 2 (10 pts) Suppose A(x;r)is a PPT primality testing algorithm. We denote by xthe
input (an integer, given in binary) and by rthe random string of bits used by A(as discussed in
class). Suppose that the running time of Ais n3. Thus, we can suppose w.l.o.g (without loss of
generality) that, if x∈ {0,1}nthen r∈ {0,1}n3(the algorithm cannot toss more coins than its
running time). For every m, denote by Umthe random variable uniformly distributed over {0,1}m.
Then (equaling 1if xis prime and 0otherwise), by the definition of a PPT decision algorithm we
have that for every x∈ {0,1}n,
Pr[A(x, Un3) = P RIM E (x)] ≥2/3,
where PR IM E(x)is the primality function.
1. Show that there exists a deterministic, non-uniform polynomial time algorithm Bthat
computes primality on most of the inputs. Namely, such that for at least 2/3of the inputs
x∈ {0,1}nwe have B(x) = P RIM E (x)and Bis deterministic (but the code of Bcan be
different for each n). Explain what prevents you from making Bauniform polynomial time
algorithm.
2. Suppose Y= (Ym)∞
m=1 is a sequence of random variables with each Ym∈ {0,1}mand such
that Ymis ε-statistically close to the uniform distribution Um. Show that for all x∈ {0,1}n
Pr[A(x, Yn3) = P RIM E (x)] ≥2/3−ε,
Problem 3 (15 pts) Suppose we have randomized algorithm for computing a function fwhich
gives an incorrect answer with probability ≤1/3, and we want to reduce its error by repeating it
several times and taking a majority vote. Use the Chernoff Bound to estimate how many repetitions
suffice to reduce the error probability to 1/1000. And to 2−k?
1
pf2

Partial preview of the text

Download Cryptography Homework 2: Function Growth Rates and Primitivity Testing and more Exercises Cryptography and System Security in PDF only on Docsity!

COS 433/MAT 473 — Cryptography — Homework 2.

Due Wed Oct 2 (Print and hand in at the beginning of class).

Please type up your solutions using LATEX.

See course homepage for collaboration policy and late submissions.

Problem 1 (15pts) Arrange the following functions in increasing order of growth rate, so that for two consecutive functions f (n), g(n) in your sequence, either f (n) = o(g(n)) or f (n) = Θ(g(n)). Explain the relationships of all adjacent pairs of functions in your order. Assume here that log is a logarithm to base 2 and ln is a logarithm to base e.

n!, log n, (log n)n, n^7 , ln n, log(n^4 ),

n 7

, 2 log^ n, 2 ln

(^2) n , nn, n(log^ n).

Problem 2 (10 pts) Suppose A(x; r) is a PPT primality testing algorithm. We denote by x the input (an integer, given in binary) and by r the random string of bits used by A (as discussed in class). Suppose that the running time of A is n^3. Thus, we can suppose w.l.o.g (without loss of generality) that, if x ∈ { 0 , 1 }n^ then r ∈ { 0 , 1 }n 3 (the algorithm cannot toss more coins than its running time). For every m, denote by Um the random variable uniformly distributed over { 0 , 1 }m. Then (equaling 1 if x is prime and 0 otherwise), by the definition of a PPT decision algorithm we have that for every x ∈ { 0 , 1 }n,

Pr[A(x, Un 3 ) = P RIM E(x)] ≥ 2 / 3 ,

where P RIM E(x) is the primality function.

  1. Show that there exists a deterministic, non-uniform polynomial time algorithm B that computes primality on most of the inputs. Namely, such that for at least 2 / 3 of the inputs x ∈ { 0 , 1 }n^ we have B(x) = P RIM E(x) and B is deterministic (but the code of B can be different for each n). Explain what prevents you from making B a uniform polynomial time algorithm.
  2. Suppose Y = (Ym)∞ m=1 is a sequence of random variables with each Ym ∈ { 0 , 1 }m^ and such that Ym is ε-statistically close to the uniform distribution Um. Show that for all x ∈ { 0 , 1 }n

Pr[A(x, Yn 3 ) = P RIM E(x)] ≥ 2 / 3 − ε,

Problem 3 (15 pts) Suppose we have randomized algorithm for computing a function f which gives an incorrect answer with probability ≤ 1 / 3 , and we want to reduce its error by repeating it several times and taking a majority vote. Use the Chernoff Bound to estimate how many repetitions suffice to reduce the error probability to 1 / 1000. And to 2 −k?

Problem 4 (20 pts) NP and factoring.

  1. Let L = {(x, y) ∈ N × N : x has a factor between 2 and y}. Show that the language L is in NP.
  2. Show that if P = NP then there is a polynomial-time algorithm for integer factorization.

Problem 5 (15 pts) In class, we showed that if an encryption scheme has computationally indis- tinguishable encryptions then it also satisfies guessing indistinguishability. Show that the converse of this statement is also true.

Problem 6 (15 pts) Let (Xn)n∈N and (Yn)n∈N be two sequences of random variables so that Xn and Yn both take values in { 0 , 1 }t(n)^ for some polynomially bounded function t : N 7 → N. We say that the two sequences (Xn)n∈N and (Yn)n∈N are computationally indistinguishable if for every non-uniform PPT algorithm A, we have

|Pr[A(Xn) = 1] − Pr[A(Yn) = 1]| ≤ neg(n).

  1. Show that, if Xn is computationally indistinguishable from Yn and Yn is comp. indist. from Zn, then Xn is comp. indist. from Zn.
  2. Suppose in the previous question, instead of three sequences, you had k sequences X n^1 ,... , Xnk with every consecutive pair being comput. indist. Show that X n^1 is comput. indist. from Xnk as long as k = poly(n).
  3. For each x ∈ { 0 , 1 }n^ let π(x) ∈ { 0 , 1 }n^ be the ‘cyclic shift’ of x. That is, if x = (x 1 ,... , xn) with each xi ∈ { 0 , 1 }, then π(x) = (xn, x 1 , x 2 ,... , xn− 1 ). Show that if Xn is comp. indist. from Yn then π(Xn) is comput. indist. from π(Yn).

Problem 7 (10 pts) We call a sequence of sets Sn ⊂ { 0 , 1 }n^ pseudo-random if the (sequence of ) random variables Xn, distributed uniformly on Sn is comput. indist. from the uniform distribution on { 0 , 1 }n.

  1. Show that there does not exist a pseudorandom sequence of sets with sizes |Sn| ≤ poly(n).
  2. Let Fn : { 0 , 1 }s(n)^7 → { 0 , 1 }n^ be a sequence of mappings computed by a uniform PPT algo- rithm. Show that, if P = N P , then the image of Fn (the set {Fn(x) | x ∈ { 0 , 1 }s(n)}) is not pseudorandom.
  3. FFN^1 : Show that there exist a pseudorandom sequence of sets with size |Sn| ≤ 2 o(n)^ (Hint: (1) For each n pick the set Sn at random (2) upper bound the probability that, for a given n, a particular non uniform algorithm will distinguish it from uniform (3) bound the number of non uniform PPT algorithms for a fixed input size n (4) use the union bound to bound the probability that there exists a non uniform PPT distinguisher (5) conclude that, since the probability of success is positive, there must exist a set satisfying the definition.).

(^1) For Fun Only: This problem will not be graded and will not affect your grade.