Sunteți pe pagina 1din 3

Math 135 (Summer 2006)

Vigen`ere Keyword Cipher


The Vigen`ere square cryptosystem is an example of a polyalphabetic substitution. That is, different
letters in the plaintext are encrypted with different substitution alphabets.
Recall that the numerical equivalents of the letters are as follows:
A
0
N
13

B
1
O
14

C
2
P
15

D
3
Q
16

E
4
R
17

F
5
S
18

G
6
T
19

H
7
U
20

I
8
V
21

J
9
W
22

K
10
X
23

L
11
Y
24

M
12
Z
25

Secret key: correspondents agree on a keyword.


To encrypt: Write the keyword repeatedly alongside the plaintext, convert both the plaintext and the
keyword letters to their numerical equivalents (0 for A, 25 for Z) and add them modulo 26.
Example: If the keyword is WIND and the plaintext is GO AHEAD MAKE MY DAY, then the ciphertext is
plain
x
key
k
(x + k) MOD 26
cipher

G
6
W
22
2
C

O
14
I
8
22
W

A
0
N
13
13
N

H
7
D
3
10
K

E
4
W
22
0
A

A
0
I
8
8
I

D
3
N
13
16
Q

M
12
D
3
15
P

A
0
W
22
22
W

K
10
I
8
18
S

E
4
N
13
7
R

M
12
D
3
15
P

Y
24
W
22
20
U

D
3
I
8
11
L

A
0
N
13
13
N

Y
24
D
3
1
B

To decrypt: Write the keyword repeatedly alongside the ciphertext, convert both the ciphertext and
the keyword letters to their numerical equivalents, and subtract them modulo 26.
Example: If the keyword is NUMBER and the plaintext is GBATI NUIOB RTBOZ UEEQN TPWVJ BADEE G,
then the encipherment is
cipher
y
key
k
(y k) MOD 26
plain

G
6
N
13
19
T

B
1
U
20
7
H

A
0
M
12
14
O

T
19
B
1
18
S

I
8
E
4
4
E

cipher
c
key
k
(c k) MOD 26
plain

N
13
U
20
17
T

T
19
M
12
7
H

N
13
R
17
22
W
P
15
B
1
14
O

U
20
N
13
7
H
W
22
E
4
18
S

I
8
U
20
14
O
V
21
R
17
4
E

O
14
M
12
2
C

B
1
B
1
0
A

J
9
N
13
20
W

B
1
U
20
7
H

R
17
E
4
13
N
A
0
M
12
14
O

T
19
R
17
2
C
D
3
B
1
2
C

B
1
N
13
14
O

O
14
U
20
20
U

Z
25
M
12
13
N

E
4
E
4
0
A

E
4
R
17
13
N

G
6
N
13
19
T

U
20
B
1
19
T

E
4
E
4
0
A

E
4
R
17
13
N

And the joke is: There are three kinds of mathematicians, . . . .


Observation: Using modular arithmetic, it is easy to encrypt and decrypt messages using the Vigen`ere
square. Notice that if the keyword is of length k, then every kth letter is enciphered with the same shift
substitution.

Q
16
N
13
3
D

Property: Vigen`ere encipherments with longer keywords tend to even out the distribution of letters in
the ciphertexts. Thus the statistics in the underlying plaintext are obscured.
Cryptanalysis of a Vigen`
ere Enciphered Text
Example: Suppose that the ciphertext is
CTMYR DOIBS RESRR RIJYR EBYLD IYMLC CYQXS RRMLQ FSDXF OWFKT CYJRR IQZSM X
and it is known that the keyword is a three letter English word (i.e., k = 3).
The basic idea is that three monoalphabetic shifts are used to get
Y
R

C
T
M

O
I
D

S
R
B

...
...
E ...

That is, if we write the ciphertext in three columns, we see that every letter in the first column is the
result of a shift by an amount corresponding to the first letter in the keyword, every letter in the second
column is the result of a shift by an amount corresponding to the second letter in the keyword, and
similarly, every letter in the third column is the result of a shift by an amount corresponding to the
third letter in the keyword.
CTM
YRD
OIB
SRE
SRR
RIJ
YRE
BYL
DIY
MLC
CYQ
XSR
RML
QFS
DXF
OWF
KTC
YJR
RIQ
ZSM
X
Determine the likely shift values and try out the corresponding possible keywords.

let#1
C
Y
O
S
R
B
D
M
X
Q
K
Z

freq#1
2
3
2
2
3
1
2
1
2
1
1
1

let#2
T
R
I
Y
L
S
M
F
X
Y
J

freq#2
2
4
4
2
1
2
1
1
1
2
1

let#3
M
D
B
E
R
J
L
Y
C
Q
S
F

freq#3
2
1
1
2
3
1
2
1
2
2
1
2

If E
7 Y, then shift is 24 4 = 20 so key letter is U.
If T
7 Y, then shift is 24 19 = 5 so key letter is F.
If N
7 Y, then shift is 24 13 = 11 so key letter is L.
etc.
Continuing in this way, we find the most likely first, second, and third letters.
likely#1
U
F
L
K
H
Q
Y
G

likely#2
N
Y
E
D
A
J
R
Z

likely#3
N
Y
E
D
A
J
R
Z

Therefore, some likely keywords are: FAD, FAN, FAR, FED, FEN, LEE, LEA, KEN, KEY, HER, GAY,
....
Knowledge that the keyword is a real three-letter English word vastly reduces the amount of work
from trying out all three-letter strings, or all two, four, five, . . . letter strings.
cipher
key
plain
cipher
key
plain

CTMYRDOIB...
FEDFEDFED...
XJTN...
CTMYRDOIBSRE...
KEYKEYKEYKEY...
SPOONFEEDING...

And so we find: SPOONFEEDING IN THE LONG RUN TEACHES US NOTHING BUT THE SHAPE OF THE SPOON.

S-ar putea să vă placă și