Information Theory and Python Code for OTP Cipher
Last time we discussed about the theory of OTP cipher and how it actually works. Today we will prove how OTP is "secure" in terms of "PERFECT SECRECY" with the help of Information theory by the father cryptography, Claude Shannon. Also at the end of the blog, link for the Python code for OTP cipher is provided. Feel free to wander about the GitHub repo for more Python related stuff.
Information
Theory :
So the first person to study the
Security of the cipher was Claude Shannon in 1949 who is also known as the
father of the Information Theory and he published a famous paper back in 1949
where he studied about the security of the OTP.
Now the basic idea behind the
Information Theory was that for a given cipher text C, it should
not reveal any information about the Plain Text P.
So to define the basic idea formally,
we can say that cipher (E,D) over the triple (K,M,C) has a
perfect secrecy if for every two messages (m0 , m1)
from the message space and for every cipher text C from
the cipher text space, the probability of getting C by encrypting
the message m0 with the key k is same as
the probability of getting C by encrypting the message m1
with the key k. where k is uniform in the key space and k
is always a random variable over the key space.
That is,
P
[ E(k,m0) = c] = P [
E(k,m1) = c]
So in order to summarize, if an
attacker intercepts the cipher text c, because the probability of
getting c from m0 is same as getting c from m1,
he will have no idea about what the actual message was and this property is in
fact, true for all such messages and one will have no idea from where the
cipher text c came from as all the messages will have the same
probability to generate the cipher text c. So what we can derive
from this is that no matter how powerful the attacker is he will not get any
information about the plain text from the only given cipher text. Which means
that there is no “Cipher Text Only” attack possible in this situation
(but other attacks may be possible).
Link for the Python code of OTP cipher: https://github.com/devanshkaria88/Python_Playground/blob/master/Ciphers/OTP%20Cipher.py
Comments
Post a Comment