Shannon`s theory

Download Report

Transcript Shannon`s theory

Shannon’s theory
Ref. Cryptography: theory and practice
Douglas R. Stinson
Shannon’s theory


1949, “Communication theory of Secrecy
Systems” in Bell Systems Tech. Journal.
Two issues:

What is the concept of perfect secrecy? Does
there any cryptosystem provide perfect secrecy?


It is possible when a key is used for only one
encryption
How to evaluate a cryptosystem when many
plaintexts are encrypted using the same key?
Outline

Introduction





One-time pad
Elementary probability theory
Perfect secrecy
Entropy
Spurious keys and unicity distance
Categories of cryptosystem (1)

Computational security:



The best algorithm for breaking a cryptosystem
requires at least N operations, where N is a very
large number
No known practical cryptosystem can be proved
to be secure under this definition
Study w.r.t certain types of attacks (ex.
exhaustive key search) does not guarantee
security against other type of attack
Categories of cryptosystem (2)

Provable security



Reduce the security of the cryptosystem to some
well-studied problems that is thought to be
difficult
Ex. RSA  integer factoring problem
Unconditional security

A cryptosystem cannot be broken, even with
infinite computational resources
One-Time Pad



Unconditional security !!!
Described by Gilbert Vernam in 1917
Use a random key that was truly as long as
the message, no repetitions
P  C  K  (2 ) n
x  ( x1 ,, xn )
K  ( K1 ,, K n )
eK ( x)  ( x1  K1 ,, xn  K n ) mod 2
For ciphertext
y  ( y1 ,, yn )
d K ( y)  ( y1  K1 ,, yn  K n ) mod 2
Example: one-time pad

Given ciphertext with Vigenère Cipher:
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
Decrypt by hacker 1:
Ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
Key:
pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih
Plaintext: mr mustard with the candlestick in the hall
Decrypt by hacker 2:
Ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
Key:
pftgpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt
Plaintext: miss scarlet with the knife in the library
Which one?
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
?
a
A
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
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
s
S
T
U
V
W
X
Y
Z
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
t
T
U
V
W
X
Y
Z
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
u
U
V
W
X
Y
Z
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
v
V
W
X
Y
Z
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
w
W
X
Y
Z
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
x
X
Y
Z
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
y
Y
Z
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
z
Z
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
?
?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Problem with one-time pad


Truly random key with arbitrary length?
Distribution and protection of long keys


The key has the same length as the plaintext!
One-time pad was thought to be unbreakable,
but there was no mathematical proof until
Shannon developed the concept of perfect
secrecy 30 years later.
Preview of perfect secrecy (1)

When we discuss the security of a
cryptosystem, we should specify the type of
attack that is being considered


Ciphertext-only attack
Unconditional security assumes infinite
computational time


Theory of computational complexity ×
Probability theory ˇ
Preview of perfect secrecy (2)


Definition: A cryptosystem has perfect
secrecy if Pr[x|y] = Pr[x] for all xP, yC
Idea: Oscar can obtain no information about
the plaintext by observing the ciphertext
Bob
Alice
y
x
Oscar
Outline

Introduction





One-time pad
Elementary probability theory
Perfect secrecy
Entropy
Spurious keys and unicity distance
Discrete random variable (1)



Def: A discrete random variable, say X,
consists of a finite set X and a probability
distribution defined on X.
The probability that the random variable X
takes on the value x is denoted Pr[X=x] or
Pr[x]
Pr[ x]  1
0≤Pr[x] for all xX,

xX
Discrete random variable (2)


Ex. Consider a coin toss to be a random
variable defined on {head, tails} , the
associated probabilities Pr[head]=Pr[tail]=1/2
Ex. Throw a pair of dice. It is modeled by
Z={(1,1), (1,2), …, (2,1), (2,2), …, (6,6)}
where Pr[(i,j)]=1/36 for all i, j.
sum=4 corresponds to {(1,3), (2,2), (3,1)}
with probability 3/36
Joint and conditional probability



X and Y are random variables defined on
finite sets X and Y, respectively.
Def: the joint probability Pr[x, y] is the
probability that X=x and Y=y
Def: the conditional probability Pr[x|y] is the
probability that X=x given Y=y
Pr[x, y] =Pr[x|y]Pr[y]= Pr[y|x]Pr[x]
Bayes’ theorem


Pr[ x] Pr[ y | x]
If Pr[y] > 0, then Pr[ x | y ] 
Pr[ y ]
Ex. Let X denote the sum of two dice.
Y is a random variable on {D, N},
Y=D if the two dice are the same. (double)
Pr[ 4 | D] Pr[ D] (1 / 6)(1 / 6) 1
Pr[ D | 4] 


Pr[ 4]
3 / 36
3
Outline

Introduction





One-time pad
Elementary probability theory
Perfect secrecy
Entropy
Spurious keys and unicity distance
Definitions




Assume a cryptosystem (P,C,K,E,D) is
specified, and a key is used for one
encryption
Plaintext is denoted by random variable x
Key is denoted by random variable K
Ciphertext is denoted by random variable y
Ciphertext
Plaintext
y
x
K
Perfect secrecy


Definition: A cryptosystem has perfect
secrecy if Pr[x|y] = Pr[x] for all xP, yC
Idea: Oscar can obtain no information about
the plaintext by observing the ciphertext
Bob
Alice
y
x
Oscar
Relations among x, K, y

Ciphertext is a function of x and K
Pr[ y  y ] 
 Pr[K  K ] Pr[x  d
{ K : yC ( K )}

K
( y )]
y is the ciphertext, given that x is the
plaintext
Pr[y  y | x  x] 
 Pr[K  K ]
{ K :x  d K ( y )}
Relations among x, K, y

x is the plaintext, given that y is the
ciphertext
Pr[ x] Pr[ y | x]
Pr[ x  x | y  y ] 
Pr[ y ]
Pr[ x  x] 

 Pr[K  K ]
{ K :x  d K ( y )}
 Pr[K  K ] Pr[x  d
{ K : yC ( K )}
K
( y )]
Ex. Shift cipher has perfect
secrecy (1)


Shift cipher: P=C=K=Z26 , encryption is
defined as e ( x)  ( x  K ) mod 26
K
Ciphertext:
Pr[y  y] 

 Pr[K  K ] Pr[x  d
 Pr[ x  y  K ]
KZ 26
1
26
KZ 26
 261
K
1
Pr[
x

y

K
]


26
KZ 26
( y)]
Ex. Shift cipher has perfect
secrecy (2)

Pr[y|x]  Pr[K  ( y  x) mod 26] 

Apply Bayes’ theorem
1
26
Pr[ x] Pr[ y | x]
Pr[ x | y ] 
Pr[ y ]

Pr[ x]
1
26
1
26
 Pr[ x]
Perfect secrecy
Perfect secrecy when |K|=|C|=|P|


(P,C,K,E,D) is a cryptosystem where
|K|=|C|=|P|.
The cryptosystem provides perfect secrecy iff



every keys is used with equal probability 1/|K|
For every xP, yC, there is a unique key K such
that eK ( x)  y
Ex. One-time pad in Z2
Outline

Introduction





One-time pad
Elementary probability theory
Perfect secrecy
Entropy
Spurious keys and unicity distance
How about the security when many plaintexts are
encrypted using one key?
Preview (1)
Ciphertext
Plaintext
yn
xn
K

We want to know:
the average amount of ciphertext required
for an opponent to be able to uniquely
compute the key, given enough computing
time
Preview (2)


We want to know:
How much information about the key is
revealed by the ciphertext
= conditional entropy H(K|Cn)
We need the tools of entropy
Entropy (1)

Suppose we have a discrete random variable
X



What is the information gained by the outcome
of an experiment?
Ex. Let X represent the toss of a coin,
Pr[head]=Pr[tail]=1/2
For a coin toss, we could encode head by 1,
and tail by 0 => i.e. 1 bit of information
Entropy (2)




Ex. Random variable X with Pr[x1]=1/2,
Pr[x2]=1/4, Pr[x3]=1/4
The most efficient encoding is to encode x1
as 0, x2 as 10, x3 as 11.
Notice: probability 2-n => n bits
p => -log2 p
The average number of bits to encode X
1
1
1
3
1   2   2 
2
4
4
2
Entropy: definition

Suppose X is a discrete random variable
which takes on values from a finite set X.
Then, the entropy of the random variable X
is defined as
H ( X)    Pr[ x] log 2 Pr[ x]
xX
Entropy : example

Let P={a, b}, Pr[a]=1/4, Pr[b]=3/4.
K={K1, K2, K3}, Pr[K1]=1/2, Pr[K2]=Pr[K3]=
1/4.
a
b
encryption matrix: K
1
2
1
K2
K3
2
3
1
1 3
3
H(P)=  log 2  log 2  0.81
4
4 4
4
H(K)=1.5, H(C)=1.85
3
4
Conditional entropy

Known any fixed value y on Y, information
about random variable X
H ( X | y)   Pr[ x | y ] log 2 Pr[ x | y ]
x

Conditional entropy: the average amount of
information about X that is revealed by Y
H ( X | Y)   Pr[ y ] Pr[ x | y ] log 2 Pr[ x | y ]
y

x
Theorem: H(X,Y)=H(Y)+H(X|Y)
Theorem (1)


Let (P,C,K,E,D) be a cryptosystem, then
H(K|C) = H(K) + H(P) – H(C)
Proof:
H(K,P,C) = H(C|K,P) + H(K,P)
Since key and plaintext uniquely determine the ciphertext
H(C|K,P) = 0
H(K,P,C) = H(K,P) = H(K) + H(P)
Key and plaintext are independent
Theorem (2)

We have
Similarly,

Now,

H(K,P,C) = H(K,P) = H(K) + H(P)
H(K,P,C) = H(K,C) = H(K) + H(C)
H(K|C)= H(K,C)-H(C)
= H(K,P,C)-H(C)
= H(K)+H(P)-H(C)