This is an old revision of the document!
Advantage. The purpose of this problem is to clarify the concept of advantage. Con- sider the following two experiments EXP(0) and EXP(1):
The adversary’s goal is to distinguish these two experiments: at the end of each experiment the adversary outputs a bit 0 or 1 for its guess for which experiment it is in. For b = 0,1 let Wb be the event that in experiment b the adversary output 1. The adversary tries to maximize its distinguishing advantage, namely the quantity Adv = | Pr[W0] − Pr[W1] | ∈ [0, 1] .
The advantage Adv captures the adversary’s ability to distinguish the two experiments. If the advantage is 0 then the adversary behaves exactly the same in both experiments and therefore does not distinguish between them. If the advantage is 1 then the adversary can tell perfectly what experiment it is in. If the advantage is negligible for all efficient adversaries (as defined in class) then we say that the two experiments are indistinguishable.
a. Calculate the advantage of each of the following adversaries:
b. What is the maximum advantage possible in distinguishing these two experiments? Explain why.
Let's use the experiment defined earlier as a pseudorandom generator (PRG) as follows:
a. Implement the frequency (monobit) test from NIST (see section 2.1): http://csrc.nist.gov/publications/nistpubs/800-22-rev1a/SP800-22rev1a.pdf
and check if a sequence generated by the above PRG (say n=100) seems random or not.
b. Run the test on a random bitstring (e.g. a string such as R used by the above PRG), and compare the result of the test.
If the two results are different across many iterations, this test already gives you an attacker that breaks the PRG.
import random def get_random_string(n): #generate random bit string bstr = bin(random.getrandbits(n)).lstrip('0b').zfill(n) return bstr