The adversary A picks two messages m0,m1∈{0,1} and sends them to the challenger. The challenger samples k${0,1} and b${0,1}, computes cb=k⊕mb, and sends the ciphertext back to the adversary. The adversary then outputs a guess b′. We want to show that AdvAdistinguishcipher=0 for the one-time pad.
Setting Up the Probability
The advantage is defined in terms of Pr[b′=b]. Expanding by cases on b:
I couldn't figure out how to reason about the two conditional probabilities Pr[b′=1∣b=1] and Pr[b′=0∣b=0], because the adversary is the one choosing b′. Depending on the adversary, it could always output b′=1, or always output b′=0, or flip a fair coin internally, or run some fancy function of the ciphertext. Since the proof needs to work for all adversaries, I didn't know how to assign a concrete value to those probabilities. They seemed completely under the adversary's control, not something I could calculate from the game description alone.
The Key Move: Condition on the Key
The trick is to not think about what the adversary "decides" to do, but instead condition on the random variable the adversary actually sees, which is the ciphertext. And the ciphertext depends on the key k. Expanding Pr[b′=1∣b=1] by conditioning on k:
The adversary's behavior reduces to a deterministic function of its input. We don't need to know what the adversary does. We just need to know that for any fixed input x, Pr[A(x)=1]+Pr[A(x)=0]=1.
The Two Cases
Claim:Pr[b′=1∣b=1]+Pr[b′=0∣b=0]=1, regardless of the adversary's strategy.
Case 1: The adversary chooses m0=m1. Then 1⊕m0=1⊕m1, so the matching pairs are:
Pr[A(m1)=1]+Pr[A(m0)=0]=1
Pr[A(1⊕m1)=1]+Pr[A(1⊕m0)=0]=1
Case 2: The adversary chooses m0=m1. Since the message space is {0,1}, one message is 0 and the other is 1, so m1=1⊕m0. The matching pairs cross over:
Pr[A(m1)=1]+Pr[A(1⊕m0)=0]=1
Pr[A(1⊕m1)=1]+Pr[A(m0)=0]=1
In both cases, the weighted sum gives exactly 1. So: