CRYPTOGRAPHY

We hope you understood the modular arithmetic lesson.  This kind of mathematics is used in defending the United States and other countries during wars and other times when there is information that has to be kept confidential.  It was used during the Civil War in the 1860's and even thousands of years ago during Caesar's Roman Empire.  People who wanted to communicate with allies but not their enemies would send encrypted
messages back and forth.

An encrypted message takes the letters and numbers of a message and transforms them into a different series of letters and numbers that do not make sense unless you know the code to unscramble them.  If you know the code, then you can read the message.  Amazingly complex scrambling procedures can stump highly trained people and even computers.  We will talk about simple ciphers.

A cipher is the method by which you encrypt a message.

Before we begin, we must first create a numerical alphabet by assigning numbers, beginning with zero, to each letter of the alphabet.


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
0   1   2   3  4   5  6   7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22  23 24 25


Most ciphers use modular arithmetic during some steps of the encryption and decryption process.  We have used the numbers 0 through 25 to represent English letters, so we will use mod 26 in all our cipher examples.

SHIFT CIPHER
First we translate our message into our numerical alphabet.
For example, the code name "Brian" looks like this:

B  R  I  A  N
1  17 8  0  13


Now choose the number you want to shift by, say 7.
We call this our "shift" value.  This will help us decipher the message later. We now shift our cipher by adding "shift" to each of the numbers from our code work like this:

B: 1 + 7 = 8
R: 17 + 7 = 24
I: 8 + 7 = 15
A: 0 + 7 = 7
N: 13 + 7 = 20

We now translate the numbers back into our letters using our numerical alphabet.  The name "BRIAN" encrypted with a "shift" of 7 is: I Y P H U

Now try another example, the phrase "is a spy" using the same "shift."

What is does "is a spy" look like when you encrypt it?  _______________

To make life harder for spies, most encrypters remove punctuation and group the letters in "words" that are usually five letters long.  Thus our encrypted message would look like IYPHU PZHZW F


Now suppose you know the shift value is 10.  Decrypt the following message.
(What would you need to do to each letter to get your original letter back?)

MCIZD YQCKZ RI

MULTIPLICATION CIPHER
This is similar to the shift cipher, except that you multiply and divide instead of add and subtract.  We'll start with a simple example.

Let's work with the word SIMPLE

SIMPLE in the numeric alphabet is __ __ __ __ __ __

1) We will use the "multiplie) ________________

 

3) Does this seem right to you? Why do you think this happened?

 

4) Which multipliers will be okay when doing (mod 26)?

r" 7.  Multiply the numeric alphabet numbers each by the "multiplier" and do (mod 26).
S becomes __ I becomes __ M becomes __
P becomes __ L becomes __ E becomes __

2) Use the "multiplier" 10 and encrypt the word FANS.

(F =5, A = 0, N = 13, S = 18

 

Decrypting a multiplier cipher
How do we decrypt a message using the multiplication cipher?

We already know that SIMPLE encrypted with multiplier 7 is WEGBZC.

How do we get back to SIMPLE from WEGBZC?

Before we answer this question, let’s first go back to something we already know how to do. If we wanted to solve 7x=33, we multiply 7 by its multiplicative inverse 1/7. This gives us 1 on the left hand side.

Decipher WEGBZC: we need to multiply each number by the "inverse" of 7 in modular arithmetic. The inverse of 7 (mod 26) is a number N so that 7*N is equal to 1 (mod 26).

5) What is the inverse of 7 (mod 26)? ________________

6) Now multiply each letter in WEGBZC by your answer to get back to SIMPLE

 

AFFINE CIPHER
We can also combine the shift cipher and the multiplication cipher. This is called an affine (or linear) cipher. What we do, is we first multiply the cipher by a "multiplier." We then use a "shift." This is an
α*x + β cipher, where α is the “multiplier” and β is the “shift.”

Example: CHAIR with an affine shift of 7*x + 5 is:

C H A I R ----- 2 7 0 8 17

7*2 + 5 = 19, mod 26 = 19 which is T

7*7 + 5 = 54, mod 26 = 2 which is C

7*0 + 5 = 5, mod 26 = 5 which is E

7*8 + 5 = 61, mod 26 = 9 which is J

7*17 + 5 = 124, mod 26 = 20 which is U

 

Return to Lessons & Activities