Applied Cryptography Week 4 Cryptography and.NET 1 Applied Cryptography Week 4 Mike McCarthy.
Cryptography
description
Transcript of Cryptography
![Page 1: Cryptography](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/1.jpg)
Math for Liberal Studies – Fall 2008
![Page 2: Cryptography](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/2.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/3.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/4.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/5.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/6.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/7.jpg)
The message XVHWK HIRUF HOXNH has been encoded using the Caesar cipher
Decode the message
USE THE FORCE LUKE
![Page 8: Cryptography](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/8.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/9.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/10.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/11.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/12.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/13.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/14.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/15.jpg)
THISISMYMESSAGEMATHMATHMATHMAT
Now add the two rows together:
FHBZUSFFYELZMGX
![Page 16: Cryptography](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/16.jpg)
Encode the message HASTA LA VISTA BABY using the keyword ARNOLD
HRFH LOAM VGED BROM
![Page 17: Cryptography](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/17.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/18.jpg)
Decode the message “REAFX PSLLM VILGF UIWV” using the keyword “JESSE”
I AIN’T GOT TIME TO BLEED
![Page 19: Cryptography](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/19.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/20.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/21.jpg)
Encode the message “LORD OF THE RINGS” with the Autokey cipher using keyword “FRODO”
LORDOFTHERINGSFRODOLORDOFTHE
QFFGCQHYHFNGNW
![Page 22: Cryptography](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/22.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/23.jpg)
Decode the message “XHRVX HDSGG ATSAR TV” using the keyword “RETURN”
We know we need to subtract:
XHRVXHDSGGATSARTVRETURNFORESTMOONOFORESTMOONOFENDOR
![Page 24: Cryptography](https://reader035.fdocuments.us/reader035/viewer/2022070502/568154f3550346895dc2e57a/html5/thumbnails/24.jpg)
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