Cryptography

24
Math for Liberal Studies – Fall 2008

description

Math for Liberal Studies – Fall 2008. Cryptography. Adding Security to Messages. How do we protect the security of the messages we send? This is a very important issue in the information age Consider the number of times you send information you hope is secure: text messaging e-mail - PowerPoint PPT Presentation

Transcript of Cryptography

Page 1: Cryptography

Math for Liberal Studies – Fall 2008

Page 2: Cryptography

How do we protect the security of the messages we send?

This is a very important issue in the information age

Consider the number of times you send information you hope is secure: text messaging e-mail online shopping etc.

Page 3: Cryptography

It is largely impossible to prevent messages from being intercepted

Since we can’t keep people from reading our messages, we should try to disguise them so that the messages only make sense to the intended recipient

This process is called “encryption”

Page 4: Cryptography

Whenever we encrypt a message, it is vital that we do it systematically

It is hard to keep messages secret, but much easier to have a secret system

Many systems are based on a keyword or phrase that is only known to a select few

Page 5: Cryptography

The simplest cipher was used originally by Julius Caesar

Take the letters of your message and change them according to this rule: A D B E C F D G etc. W Z X A Y B Z C

Page 6: Cryptography

ATTACK AT DAWN

This becomes DVVDFN DV GDZQ

Notice that the new message looks like nonsense, but we can recover the original message since we know the rule

Sometimes we will remove the spaces and write the message in blocks of equal numbers of letters: DVVD FNDV GDZQ

This further disguises our message

Page 7: Cryptography

The message XVHWK HIRUF HOXNH has been encoded using the Caesar cipher

Decode the message

USE THE FORCE LUKE

Page 8: Cryptography

We can take the idea of the Caesar cipher and generalize it to make it more secure

Instead of always shifting 3 letters ahead in the alphabet, we can secretly agree on a number to shift

Page 9: Cryptography

Encode the message “RETREAT” using a Caesar cipher (shift 7)

YLAYLHA

The message “ACBU CCGS” was encoded using a Caesar cipher (shift 14). Decode the message

MONGOOSE

Page 10: Cryptography

Even when we choose a secret number, this isn’t a very secure code

Whatever letter “A” gets encoded as, it will be encoded as the same letter throughout our message

Using “frequency analysis,” these types of codes are easy to break

Page 11: Cryptography

The new approach we will use is similar to the Caesar cipher

To make it easier, we will replace our letters with numbers: A = 0 B = 1 C = 2 etc. Z = 25

Page 12: Cryptography

Using these numbers, we can “add” two letters together

D + L = 3 + 11 = 14 = O

What about R + Y = 17 + 24 = 41?

When the total is over 41, we “wrap around” back to the beginning of the alphabet

Wrapping around means that we end up at 41 – 26 = 15 = P

Page 13: Cryptography

Using this new idea, we can think of the original Caesar cipher as “Add D to every letter of the message”

If we choose a secret number to use for the Caesar cipher, we can think of that as choosing a secret letter

Why not choose a secret word?

Page 14: Cryptography

For this cipher, we choose a secret keyword

Write down your original message, and then write down the keyword beneath it, repeating as many times as needed

For example, suppose our keyword is MATH

Page 15: Cryptography

THISISMYMESSAGEMATHMATHMATHMAT

Now add the two rows together:

FHBZUSFFYELZMGX

Page 16: Cryptography

Encode the message HASTA LA VISTA BABY using the keyword ARNOLD

HRFH LOAM VGED BROM

Page 17: Cryptography

How do we decode a message using the Vignère cipher?

Instead of adding the keyword, we simply subtract

Reality check: Can we subtract F – R?

This would be 5 – 17 = -12, but we just wrap around again, so add 26

-12 + 26 = 14 = O

Page 18: Cryptography

Decode the message “REAFX PSLLM VILGF UIWV” using the keyword “JESSE”

I AIN’T GOT TIME TO BLEED

Page 19: Cryptography

Even the Vignère cipher is relatively easy to crack, though it takes some more advanced techniques

Another cipher that uses some of the same ideas is called the Autokey cipher

Instead of repeating the keyword over and over, we only write it down once

Page 20: Cryptography

Suppose we want to encode the message “SAY HELLO TO MY LITTLE FRIEND” with keyword “PACINO”

This time we write down the original message, and on the next line, the keyword followed by the message again

SAYHELLOTOMYLITTLEFRIEND PACINOSAYHELLOTOMYLITTLE

Now we add the two lines together as before: HAAPR ZDORV QJWWM HXCQZ BXYH

Page 21: Cryptography

Encode the message “LORD OF THE RINGS” with the Autokey cipher using keyword “FRODO”

LORDOFTHERINGSFRODOLORDOFTHE

QFFGCQHYHFNGNW

Page 22: Cryptography

The problem with decoding a message using the Autokey cipher is that we don’t know what to subtract, since it includes the original message

We have to decode the message a little bit at a time

Page 23: Cryptography

Decode the message “XHRVX HDSGG ATSAR TV” using the keyword “RETURN”

We know we need to subtract:

XHRVXHDSGGATSARTVRETURNFORESTMOONOFORESTMOONOFENDOR

Page 24: Cryptography

Caesar cipher (shift 3) RQWKH ILQDO HADPB RXZLO O

Vignère cipher (keyword: FINAL) GMNSV JLSOC YPRSP HZRT

Autokey cipher (keyword: EXAM) RRMNR LIIMT DPAPP VW