# CRYPTOGRAPHY ACTIVITY - members.shaw.ca

Τεχνίτη Νοημοσύνη και Ρομποτική

21 Νοε 2013 (πριν από 4 χρόνια και 5 μήνες)

148 εμφανίσεις

CRYPTOGRAPHY ACTIVITY

Cryptology
or
cryptography

is the study of the encoding and decoding of secret
messages using
ciphers
(a special method to change a message to make it secret). Your
mission, if you wish to accept it, will be to
decipher

(decode) s
ome messages and to
encipher

(encode) other messages given below. Each will have a short background to
explain the cipher.

Many people want to send secret messages, for example banks, military groups, and even
friends often want to send a message witho
ut other people intercepting and reading their
message. Below you will see the progression of ciphers over the years. As
cryptanalysts

(the people who try to break codes) become more advanced at breaking secret codes, the
codes themselves are created mor
e difficult in order that they will not be broken. The
plaintext
is the original message, and the
cipher text

is the encoded message.

A.

Caesar Cipher

Julius Caesar was one of the first people to use ciphers, as he was afraid of having his
messages interc
epted and read. He used ciphers to talk with his armies, as the only
method of communication was by mail. His cipher (or method of coding) was very
simple, he shifted every letter in the alphabet by 3. For example, A = D, R = U, Z = C
(start at the begi
nning again).

Activity:

Decode this cipher text to plaintext using the Caesar Cipher:

EUXWXV, PHHW WRPRUURZ DW GXVN. LW LV LPSRUWDQW WR FRPH DORQH.

(BRUTUS, MEET TOMORROW AT DUSK. IT IS IMPORTANT TO COME ALONE.)

This cipher as you can probably guess is not difficult for cryptanalysts to break, and
needed to be modified by future cryptographers in an attempt to keep their messages
secret!

B.

Substitution Ciphers

Substitution ciphers use a table of letters where
every letter in the alphabet is
replaced by one other letter in the alphabet, in a random order (the Caesar cipher
above is a simple substitution cipher). There is only one distinct cipher text letter for
each plaintext letter.

Activity:

Using the tabl
e, decode the message below that was encoded using this
substitution cipher.

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

F

L

Y

R

B

C

S

P

K

I

H

Q

W

A

Z

D

U

G

V

J

M

O

T

E

X

N

TFG KV KWWKABAJ, VBAR PBQD AZT!

(WAR IS IMMINENT, SEND HELP NOW!)

Challenge:

How many different ways are there to rearrange the alphabet to create a
substitution cipher?

(26! = 26 x 25 x 24 x … x 3 x 2 x 1)

Now substitution ciphers are vulnerable to frequency analysis, a method cryptanalysts
use to decode messag
es. Frequency analysis involves looking at the number of times
each letter shows up in an encoded message. For example, the letter E is the most
commonly occurring letter most English text. So in a substitution cipher such as the one
above, where the en
coded message has the letter B as the most common letter in the
cipher text or encoded message, cryptanalysts would guess that B = E for the plaintext
(original) message. This can be done for many of the most frequently, and least
frequently used letters
of the alphabet, particularly in a long message. The next cipher
becomes more complex, and makes frequency analysis much more difficult.

C.

Vigenere Cipher

Vigenere ciphers use a table and a key in order to encode a message. First, the words
are put into
5 letter blocks and spaces are put between them. A key is chosen that only
the message sender and recipient know. The first letter of the message, and the first
letter of the key word are read in the chart below to find the cipher text, this continues
on
, and the key word is repeated until the message is encoded. Here’s an example using
the key word Mathematics and the message “work hard and you will succeed!” See the
table on the next page. Make sure you understand how the cipher text for the example
was created before you continue on.

KEYWORD:
MATHE MATIC S
MATH EMATI CS
MAT

PLAINTEXT:
WORK
H

ARD
AN

D
YOU
W

I LL
SU

CCEED
!

CIPHERTEXT: IOKRL MRWIP VKOND MXLLC EUQEW!

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

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

B

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

C

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

B

D

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

E

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

F

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

G

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

H

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

I

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

J

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

K

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

L

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

M

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

N

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

O

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

P

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

Q

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

R

R

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

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

Activity:

Encipher the following message using the Vigenere cipher and a secret key word
that y
ou choose: ________________ . When you are done, write down the encoded message
and keyword, and exchange with a partner and have them decipher the secret message (use
the chart on the next page to decipher your partner’s message.

KEYWORD

PLAINTEXT

CIPHERTEXT

Activity:

Decipher your partner’s cipher text. Write down their keyword:
_____
__________. In order to decipher their message, you must follow the directions
below. For each letter:

1.

Find the diagonal on the alphabet chart on the previous page corresponding to the
letter.

2.

Move along the diagonal until you match the cipher text with

the corresponding
letter in the keyword.

3.

Read the letter in the corresponding row
-

that is the plaintext letter.

(Try to decode the example cipher text in the example above using this method.)

D.

Using Algebra and Modulus to Encipher and Decipher?!

Another type of cipher uses algebra to encode and decode me
ssages. A formula can be
chosen, and
x
will represent the number of the plaintext letter (i.e. A = 1, B = 2, and so on).
You will apply your chosen equation to each letter, and will get a new number, which
represents a new letter

the cipher text letter
. For example, if the algebraic equation
chosen is 2
x

+ 1, and your plaintext is the word CIPHER,

C

= 3

and 2(3) + 1 = 7, so the encoded letter is G

I

= 9

and 2(9) + 1 = 19, so the new letter is S

P

= 16 and 2(16) + 1 = 33, so the encoded lett
er is G

(We started again at A, Z = 26, A = 27, B = 28, and so on, so 33
-

26 = 7)

H

= 8

and 2(8) + 1 = 17, so the encoded letter is Q

E

= 5

and 2(5) + 1 = 11, so the encoded letter is K

R

= 18

and 2(18) + 1 = 37, so the encoded letter is (37
-
26=11) also K!

So
CIPHER = GSGQKK

using this method of enciphering

KEYWORD

PLAINTEXT

CIPHERTEXT

Activity:

Encode the following message using the cipher mentioned above and the
formula 2
x

+ 4.

Challenge:

Why would an encoded message be difficult to decode?

Challenge:

certain letters? How do you explain t
his?

Solution

Challenge:

Why would an encoded message by this method be difficult to decode?

Because different plaintext letters give the same cipher text letters (i.e. E and M both
become D).

Challenge:

ith respect to the frequency of
certain letters? How do you explain this?

Firstly, there are only even numbered letters because our formula 2
x

+ 4 will always be
even. Secondly, Certain letters are seen very frequently, for example the letter N occurs
6
times in this message of 31 letters. Both R and E are common letters, so because both
are encoded as an N, this letter has a high frequency in this cipher.

*
Note

If you successfully completed this last activity, you are well on your way to being a
su
ccessful mathematician. The concept just explained above is termed “modulus” or just
“mod”, and it is something taught in 3
rd

year university mathematics! Congratulations!

E

N

E

M

Y

D

I

S

C

O

V

E

R

E

D

P

L

A

N

M

E

E

T

N

O

W

E

N

E

M

Y

D

I

S

C

O

V

E

R

E

D

P

L

A

N

M

E

E

T

N

O

W

5

14

5

13

25

4

9

19

3

15

22

5

18

5

4

16

12

1

14

13

5

5

20

14

15

23

14

6

14

4

2

12

22

16

10

8

22

14

14

14

12

10

2

6

6

4

14

14

18

6

8

4

N

F

N

D

B

L

V

P

J

H

V

N

N

N

L

J

B

F

F

D

N

N

R

F

H

D

Plaintext

Number of

each letter
(x)

2
x

+ 4
(reduced if
necessary)

Cip
her text

Plaintext

Number of

each letter
(x)

2
x

+ 4
(reduced if
necessary)

Cipher text

EXTRA INFORMATION ON CRYPTOGRAPHY

If you find this activity interesting, there a
re numerous activities on the web involving
cryptography, as well as mathematics courses in university involving this subject! These
ciphers we have looked at were very simple relative to some of the ciphers used in the 20
th

century. The history behind c
ryptography for both world wars is very interesting; many
events were very highly influenced by intelligence agencies and their ability or inability to
break ciphers. Many attribute the entrance of the U.S.A. into WWI to the Zimmerman
telegram, an encoded

message sent by telegraph from the German Foreign Minister, Arthur
Zimmermann, to the German embassy in Mexico City. The decoded message read as follows:

"On the first of February we intend to begin submarine warfare unrestricted. In spite of this, it
is
our intention to endeavour to keep neutral the United States of America.

If this attempt is not successful, we propose an alliance on the following basis with Mexico: That
we shall make war together and together make peace. We shall give general financ
ial support,
and it is understood that Mexico is to reconquer the lost territory in New Mexico, Texas, and
Arizona. The details are left to you for settlement.

You are instructed to inform the President of Mexico of the above in the greatest confidence as

soon as it is certain that there will be an outbreak of war with the United States and suggest that
the President of Mexico, on his own initiative, should communicate with Japan suggesting
adherence at once to this plan; at the same time, offer to mediate

between Germany and Japan.

Please call to the attention of the President of Mexico that the employment of ruthless
submarine warfare now promises to compel England to make peace in a few months.

Zimmerman" (January 19, 1917)

The ENIGMA machine, creat
ed by the Germans during WWII, was
a typewriter with a number of rotors order to encode messages.
Once the rotors were in place, a plain text letter typed on the
typewriter (i.e. an E) would be converted to cipher text (i.e. B).
The next time that letter

(the E) was typed into the typewriter, the
rotors would be in a new place, and would create a different cipher
text letter than the first time (i.e. R). The only way one could
decode a message written by the ENIGMA machine was to have their
own machine a
nd rotors, as well as the order that the rotors were in
to create the cipher text message. One set of rotors and an ENIGMA
machine was found in a sunken U
-
Boat allowing the allies to break
the German code! Another WWII story involves the American
cryptan
alysts, who if they would have been able to decode the
PURPLE messages created by the Japanese’s enciphering machine
called “MAGIC”, Pearl Harbour could have possibly been avoided.

http://www.otr.com/ciphers.shtml

http://www.vectorsite.net/ttcode.html

http://starbase.trincoll.edu/~c
rypto/