Crypto Week1
Crypto Week1
Crypto Week1
1 History
1.1 The Casesar and Mono-alphabetic Substitution Ci-
phers
According to history, Julius Caesar (who lived around 50BC) used to encode
any messages that he sent, so that anyone who intercepts the message cannot
read it. The method he used was to shift each character by 3 letters further in
the alphabet. For example, the sentence "I can read this." would be encoded
as "L fdq uhdg wklv." Clearly, this scheme is easy to decrypt even if one
doesn't know the shift, by simply tring the 26 possibilities.
Relatively stronger, but still very insecure, is the monoalphabetic substitu-
tion cipher, in which each character is represented by some other character
or symbol, not necessarily by a common shift. For example, the ciphertext
"Uv jqz vor frzu el vukrz; uv jqz vor jeyzv el vukrs." could be an encoding
of the message "It was the best of times; it was the worst of times." where
the substitution mapping is given by the table below.
Character a b e f h i m o r s t w
Substitution q f r l o u k e y z v j
Such ciphers were analyzed as early as 800 AD by the Arab mathematician
Al Kindi who wrote a treatise on cryptanalysis. The method of solving such
a cipher is to do a frequency analysis, i.e. to count the occurrences of each
character. The frequency distribution in large texts in a natural language
tend to be similar to that observed from statistical data. For the English
language, the frequency distribution is as shown in the table below.
1
2
3 Perfect Security
In the 1950s, Claude Shannon introduced the idea of perfect secrecy/perfect
security. Intuitively, a cryptosystem is perfectly secure if zero information
about the message is obtained from observing its ciphertext. This is made
precise as follows: consider a probability distribution on M . Then after ob-
serving a given ciphertext, the posterior distribution on M should be the
same as the prior distribution. For example, if the message could have been
any message in M with uniform probability, then after observing the cipher-
text c, it should be the case that c could be the encryption of any message
in M with uniform probability.
Formally, we have the following denition.
Denition 2. A private-key cryptosystem Π = (Gen, Enc, Dec) is perfectly
secure if for all m ∈ M, c ∈ C and for all random variables X dened on M ,
we have the following:
where the addition is co-ordinate wise, i.e. for each character separately. The
decryption function is:
Dec(c, k) = (c − k) (mod L)
Two examples:
Let Σ = {A, . . . , Z}6 and k = ABCABZ . Then Enc(SECRET, k) =
T GF SGS .
Let Σ = {0, 1}6 and k = 101100. Then Enc(011001, k) = 110101.
Note that for the binary alphabet, the One-Time Pad Encryption function
is the same as the XOR of the message and the key.
P r[A ∩ B]
The rst and second equality use Bayes' theorem that P r[A|B] = .
P r[B]
The last equality comes from the fact that for every xed message m, we have:
1
P r[Enc(m, k) = c] = n since the key k is picked uniformly at random. This
L
1
also shows that P r[Enc(X, k) = c] = n for any r.v. X dened on M so
L
that both numerator and denominator have the same value.
The goal in the above game is for the adversary to output b′ = b with as
large a probability as possible. Note that by simply guessing randomly, the
adversary will guess correctly with probability 1/2. Perfect indistinguisha-
bility is the property that no adversary can do better. Formally, we have the
following denition.
Denition 4. A cryptosystem Π = (Gen, Enc, Dec) over (M, C, K) is per-
fectly indistinguishable if for every adversary A, it holds that
Eav 1
P r[P rivKA,Π = 1] = .
2
5 Class Exercises
1. Show that the One-Time Pad is perfectly secure according to Denition
3.
1
Solution: For all m, c, we have: P r[Enc(m, k) = c] = .
Ln
2. Show that the following scheme is not perfectly secure according to
Denition 4. We dene M = {0, 1}n , K = {0, 1}n−1 and C = {0, 1}n .
Given a message m = m1 m2 . . . mn and k = k1 . . . kn−1 , we dene
Enc(m, k) = ((m1 . . . mn−1 )XOR(k1 . . . kn−1 )) ||mn . Here, || is the
symbol for concatenation.
Solution: The adversary chooses two messages such that one of them
has last bit zero and the other message has last bit one. On seeing the
ciphertext c = c1 . . . cn , the adversary outputs the value of cn and thus
correctly nds the message corresponding to c with probability 1.
3. Suppose that an adversary is able to guess a secret key k correctly with
1
probability . Show that if the adversary makes 3000 such guesses
1000
independently, then the probability that at least one guess is correct is
greater than 0.9.
1 3000
Solution: The probability that all guesses are incorrect is (1− ) <
1000
e−3 < 0.1, thus the probability that at least one guess is correct is
greater than 0.9. Here, we used the inequality 1 − x < e−x which is
useful in such calculations.