Introduction To Cryptography: Zahra Sadat Bahri Student No. 98110232 Homework 1 October 8, 2021
Introduction To Cryptography: Zahra Sadat Bahri Student No. 98110232 Homework 1 October 8, 2021
Problem 1:
I): Letter mi of m is ci ⊕ k thus
Proof.
∀ bit k ∈ {0, 1} : k ⊕ k = 0
ci = mi ⊕ k → ci ⊕ k = mi ⊕ k ⊕ k = mi
⇒ Deck (Enck (m)) = m
II):
1 5 1 1 7
⇒ (∗) = × + × =
2 8 2 4 16
7
⇒ P r[SKE = 1] =
16
1 1
|P r[SKE = 1] − | =
2 16
III): The A4 idiot didn’t think that when c1 = c2 ∧ m10 = m20 then it is more probable for
m0 to be encrypted and outputting 1 is extremely irrational. We correct her algorithm this
way:
1- output 0 if c1 = c2 ∧ m10 = m20 ∧ m11 ̸= m21
2- output 1 if c1 = c2 ∧ m11 = m21 ∧ m10 ̸= m20
3- generate random uniform output otherwise.
The important thing is that conditions 1 and 2 have no intersection and for that
later when we try to calculate probability of random b, it will not require complicated
calculation.
Let’s calculate the advantage.
Here m1 is encrypted so
1 1 1
P r{c1 = c2 ∧ m11 = m21 ∧ m10 ̸= m20 | b = 1} = P r{m11 = m21 ∧ m10 ̸= m20 } = × =
2 2 4
1
⇒ P r{A outputs 1 | b = 1} = + P r{random 1 | b = 1}
4
P r{A outputs 0 | b = 0} = P r{c1 = c2 ∧m10 = m20 ∧m11 ̸= m21 | b = 0}+P r{random 0 | b = 0}
1 1 1
P r{c1 = c2 ∧ m10 = m20 ∧ m11 ̸= m21 | b = 0} = P r{m10 = m20 ∧ m11 ̸= m21 } = × =
2 2 4
1
⇒ P r{A outputs 0 | b = 0} = + P r{random 0 | b = 0}
4
Now For random 0 and 1 probability:
P r{random 0 | b = 0} =
1
×(1−P r{c1 = c2 ∧m10 = m20 ∧m11 ̸= m21 | b = 0}−P r{c1 = c2 ∧m11 = m21 ∧m10 ̸= m20 | b = 0})
2
3
In the latter term m0 is encrypted so it’s impossible for c1 = c2 and m10 ̸= m20 to happen at
the same time.
1 1 3
⇒ P r{random 0 | b = 0} = × (1 − − 0) =
2 4 8
In the same way:
P r{random 1 | b = 1} =
1
×(1−P r{c1 = c2 ∧m10 = m20 ∧m11 ̸= m21 | b = 1}−P r{c1 = c2 ∧m11 = m21 ∧m10 ̸= m20 | b = 1})
2
Again it’s impossible for c1 = c2 and m11 ̸= m21 to happen at the same time.
1 1 3
⇒ P r{random 1 | b = 1} = × (1 − 0 − ) =
2 4 8
1 1 3 1 1 3 5
⇒ (∗) = ×( + )+ ×( + )=
2 4 8 2 4 8 8
5
⇒ P r[SKE = 1] =
8
1 1 1
|P r[SKE = 1] − | = >
2 8 16
(you have no idea what a nightmare typing all those equations was!)
4
Problem 2:
I): It is not perfectly secret and that is because of 0 and 13 both being in K.
Proof. For the counter example assume m = 0, m′ = 2, c = 0
|K| = |M|
m ⊕ m ⊕ (k1 ||0) = m ⊕ m ⊕ (k2 ||0) → 0 ⊕ (k1 ||0) = 0 ⊕ (k2 ||0) → (k1 ||0) = (k2 ||0) ⇒ k1 = k2
All conditions of Shannon’s Theorem are satisfied so the scheme is perfectly secret.
5
III): It is perfectly secret.
Proof. Considering the encryption matrix c = 5 and c = 6 never happen so
For all other c = 1, 2, 3, 4 we prove that P r{Enck (a) = c} = P r{Enck (b) = c} (Note that
there are only two messages)
P r{Enck (a) = 1} = P r{K = k1 } = 1
c=1 6 ⇒ P r{Enck (a) = 1} = P r{Enck (b) = 1}
P r{Enck (b) = 1} = P r{K = k4 } =
1
6
P r{Enck (a) = 2} = P r{K = k2 } = 1
c=2 3 ⇒ P r{Enck (a) = 2} = P r{Enck (b) = 2}
P r{Enck (b) = 2} = P r{K = k3 } =
1
3
P r{Enck (a) = 3} = P r{K = k3 } = 1
c=3 3 ⇒ P r{Enck (a) = 3} = P r{Enck (b) = 3}
P r{Enck (b) = 3} = P r{K = k2 } =
1
3
P r{Enck (a) = 4} = P r{K = k4 } = 1
c=4 6 ⇒ P r{Enck (a) = 4} = P r{Enck (b) = 4}
P r{Enck (b) = 4} = P r{K = k1 } =
1
6
∀c ∈ C : P r{Enck (a) = c} = P r{Enck (b) = c}
6
Problem 3:
Proof. I use notation P r{m1 , m2 } for P r{M1 = m1 ∧ M2 = m2 } and notation P r{c1 , c2 } for
P r{C1 = c1 ∧ C2 = c2 } So the the equation in the problem will look like
P r{m1 , m2 | c1 , c2 } = P r{m1 , m2 }
P r{c1 , c2 | m1 , m2 } × P r{m1 , m2 }
P r{m1 , m2 | c1 , c2 } =
P r{c1 , c2 }
We should prove that for any scheme there exists a distribution and a pair of distinct messages
P r{c1 , c2 | m1 , m2 }
and a pair of any two cipher texts for which the fraction ̸= 1 and thus
P r{c1 , c2 }
P r{m1 , m2 | c1 , c2 } ̸= P r{m1 , m2 } for that pair.
of course it can seem a little obvious that P r{c1 , c2 | m1 , m2 } is not equal to P r{c1 , c2 }
because ciphertexts surely depend on plaintexts. However it requires a counterexample to
be precisely proved.
assume uniform distribution over M. Since c1 , c2 can be anything, they can be equal. But
m1 ≠ m2 . Here P r{c1 , c2 } > 0 because simply c1 , c2 exist in C and can be chosen together
(regardless of messages). So de-numerator is not 0 and that won’t be a problem. It is
impossible that decrypting two same ciphertexts result in two different plaintext because
that won’t be a function any more and when Enck (m1 ) = c = Enck (m2 ) then Deck (c) can
be both m1 and m2 and how could the algorithm know which one to chose? As a result:
P r{c, c | m1 , m2 } = 0
P r{c, c | m1 , m2 }
So = 0 ̸= 1 → P r{m1 , m2 | c1 , c2 } = 0 ̸= P r{m1 , m2 }
P r{c1 , c2 }