Transcript Slide 1
Introduction to
Cryptography
Lecture 5
Shift Cipher
As we saw in class, shift cipher is not
secure.
There are only 26 possible shifts for
English alphabet
The letters are not mixed enough
Affine Cipher
Definition: The affine cipher is the cipher
which encrypts message using the
formula y (kx b) modm.
m is number of letter in alphabet
k and b are chosen with some restrictions
from 0,1,…,m-1
x is numerical equivalent of
corresponding letter
Modular Arithmetics
Claim: If a b mod m and c d mod m ,
then ac bd mod m .
Modular Arithmetics
Claim: If a b mod m and c d mod m ,
then ac bd mod m .
Proof: a b k1m and c d k2 m .
ac (b k1m)(d k2 m)
bd (k1d k2b)m k1k2 m
2
bd (k1d k2b k1k2 m)m
ac bd (k1d k2b k1k2 m)m
Decimation Cipher
Definition: The decimation cipher is the
cipher which encrypts message using the
formula y kx modm .
m is number of letter in alphabet
k is chosen with some restrictions from
0,1,…,m-1
x is numerical equivalent of corresponding
letter
Decimation Cipher
Examples: When k = 3 we get the table:
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 D G J M P S V Y B E H K N Q T W Z C F
I
L O R U X
When k = 4 we get the table:
A B C D E F G H
A E
I
J K L M
N
O P Q R S T U V W X Y Z
I M Q U Y C G K O S W
A
E
I M Q U Y C G K O S W
Decimation Cipher
k must be one of the: 1, 3, 5, 7, 9, 11, 15,
17, 19, 21, 23, 25.
In other words, we must have
gcd(k,26)=1.
How secure this cipher is?
Decimation Cipher
Example: Decrypt message:
CFQGEKAZEMFZMAGVMCNMOVYSV.
We know A is A.
Lets guess that E is M.
Then k 4 12 mod 26 , has two solution:
k = 3 and k =16.
STOCK MARKET REACHES NEW HIGH
Affine Cipher
Definition: The affine cipher is the cipher
which encrypts message using the
formula y (kx b) modm.
m is number of letter in alphabet
k and b are chosen with some restrictions
from 0,1,…,m-1
x is numerical equivalent of
corresponding letter
Affine Cipher
Using simple modular arithmetic we can
1
get: x (k ( y b)) mod26.
We don’t have A encrypted to A
anymore.
How secure this cipher is?
Affine Cipher
Example: Decrypt message:
SUYMCPTTWCMLCPUFRRUGKCPWIT
JQMAO.
Lets use letter frequencies to make a
guess for two letters.
Assume C is E and T is U.
Affine Cipher
Then we get two equations:
2 (4k b) mod26, 20 (19k b) mod26
So k = 22, not relatively prime 26.
Bad guess make another.
The correct answer k = 5 and b = 2.
YOU CAN TEACH AN OLD DOGMA NEW
TRICKS.
Homework
Read pg.69-80.
Exercises: 8, 9, 10 on pg.81- 82.
Those questions will be a part of your
collected homework.