Attack game played between two parties: the challenger(do experiment b) and an adversary(guess b'). Attacker’s advantage := |Pr[Exp(0) = 1] – Pr[Exp(1) = 1]| I'm confused by the definition of advantage, can you explain it?
Assistant
Absolutely, let's break it down carefully.
Context: Semantic Security (a.k.a. IND-CPA Security)
In semantic security, we define an attack game between:
A challenger, who runs the experiment.
An adversary, who tries to break the encryption.
The main idea is:
Can the adversary tell the difference between the encryption of two messages they choose?
The Experiment Exp(b)\text{Exp}(b)Exp(b)
Here's the structure:
The adversary picks two messages m0,m1m_0, m_1m0,m1 of the same length.
The challenger randomly picks a secret bit b∈{0,1}b \in {0, 1}b∈{0,1}.
The challenger encrypts mbm_bmb and sends the ciphertext back.
The adversary gets the ciphertext and outputs a guess b′∈{0,1}b' \in {0, 1}b′∈{0,1}.
We define:
Exp(0)=1\text{Exp}(0) = 1Exp(0)=1: if adversary guesses 1 when the challenger encrypted m0m_0m0
Exp(1)=1\text{Exp}(1) = 1Exp(1)=1: if adversary guesses 1 when the challenger encrypted m1m_1m1
Defining the Advantage
Now, the advantage is defined as:
∣Pr[Exp(0)=1]−Pr[Exp(1)=1]∣\left| \Pr[\text{Exp}(0) = 1] - \Pr[\text{Exp}(1) = 1] \right|∣Pr[Exp(0)=1]−Pr[Exp(1)=1]∣
This measures how differently the adversary behaves when the challenge bit is 0 vs when it's 1.
If the adversary is just guessing randomly, then:
Pr[Exp(0)=1]≈Pr[Exp(1)=1]≈0.5⇒Advantage≈0\Pr[\text{Exp}(0) = 1] \approx \Pr[\text{Exp}(1) = 1] \approx 0.5
\Rightarrow \text{Advantage} \approx 0Pr[Exp(0)=1]≈Pr[Exp(1)=1]≈0.5⇒Advantage≈0
If the adversary can distinguish them well, then these probabilities will diverge,
and the advantage becomes non-negligible (meaning the scheme is insecure).
Why take the absolute value?
Because we don’t care in which direction the probabilities differ. Whether the adversary is better at guessing when b=0b = 0b=0 or b=1b = 1b=1, any difference implies some information is leaked. So we take the absolute value to capture the magnitude of the distinguishing ability.
A More Intuitive View
You might also see this alternative form of the advantage:
AdvA=∣Pr[b′=b]−12∣\text{Adv}_{\mathcal{A}} = \left| \Pr[b' = b] - \frac{1}{2} \right|AdvA=Pr[b′=b]−21
This form directly compares how much better the adversary is at correctly guessing than pure random guessing. Both definitions are mathematically equivalent (they just write it from different perspectives).
Let me know if you'd like to go through a small example — it helps to solidify this idea!