lecture 2 9/09/2015math 3241. substitution cipher description: you permute the alphabet in a set...
TRANSCRIPT
![Page 1: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/1.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 1
Lecture 2
9/09/2015
![Page 2: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/2.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 2
Substitution cipher
Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of this cipher.)
For example, the permutationA 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
↓T H E Q U I C K B R O W N F X J M P S V L A Z Y D G
will produce
9/09/2015
![Page 3: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/3.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 3
Plaintext: Life on the Mississippi
Ciphertext: WBIUXFVKUNBSSBSSBJJB
And, to decipher the message, we must use the inverse permutationA 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
V I G Y C N Z B F P H U Q M K R D J S A E T L O X W
9/09/2015
![Page 4: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/4.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 4
• (Ignoring punctuation, spaces, and the distinction between capital letters and lower-case letters,) how many permutations of the alphabet (=the number of keys) are there?
• 26! = 403291461126605635584000000≈• So it seems to be a reasonably save cipher,
but!
9/09/2015
![Page 5: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/5.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 5
Letter frequencies• Not every character is used equally
frequently: Click here• Most commonly used letters: ETAOIN …
(which may depend on your source)—if you count spaces as letters, spaces might be more common than E.
• Most common digraphs: TH, HE, IN, ER, ... …
• Most common doubled letters: SS, EE, …9/09/2015
![Page 6: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/6.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 6
ExampleRZOLB QJOWW QBWIR DQFQE VICOB OKOLR UVIDW QFMRO IVTOH
OVZMA UFUIR UVEWM DWOBH UOVYO RQRZO UBWRM TOVRW RZOSZ
ITRQW COIBQ DOTUO VYORQ RZOWR MTOVR BOYRQ BWIVT RQRZO
WRMTO VRAIT OWRIR MROWC ZUYZD QBOHO BSZIB TFSML QVRZO
ARZOL BQJOW WQBCI WJUVO TUJZO DOEIV ZUWRO IYZUV EIAUV
MROFI ROQBY QVRUV MOTIA UVMRO FQVEO BRZIV RZOJU XOTRU
AOIVT WZQMF TRZUW ZILLO VRZOW RMTOV RWCZQ JIUFO TRQFO
IHORZ OFOYR MBOBQ QAUAA OTUIR OFSCO BORZO AWOFH OWJUV
OTUVI TTURU QVRZO LBQJO WWQBC IWJUV OTUJZ OWZUB KOTOX
LFIUV UVEIT UJJUY MFRLI WWIEO QBUJZ OJIUF OTRQE ORRZB
QMEZR ZOWSF FIDMW ZOCIW JUVOT UJZOF OJRRZ OYURS JQBIT
ISCUR ZQMRR UOBOY RQBWL OBAUW WUQVI VTUJZ OAIBB UOTCI
WIFFQ COTQV FSQVO TISQJ JJQBR ZOLMB LQWOR ZOYUR SJQBU
RWLIB RRQQK IZIVT UVYQV RBQFF UVERZ OLBQJ OWWQB WIVTR
ZOSCO BOJQB YOTRQ RIKOI VQIRZ VQRRQ FOIHO DQFQE VIUVW
OIBYZ QJAQB OFMYB IRUHO QBFOW WQVOB QMWLQ WRWXX
9/09/2015
![Page 7: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/7.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 7
Solution
• Most common letters: O (99) R (72) Q (59) I (50) , …
• Also common are: RZ (23)• So, guess O=e, R=t, Z=h, this gives
9/09/2015
![Page 8: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/8.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 8
theLB QJeWW QBWIt DQFQE VICeB eKeLt UVIDW QFMte IVTeH
eVhMA UFUIt UVEWM DWeBH UeVYe tQthe UBWtM TeVtW theSh
ITtQW CeIBQ DeTUe VYetQ theWt MTeVt BeYtQ BWIVT tQthe
WtMTe VtAIT eWtIt MteWC hUYhD QBeHe BShIB TFSML QVthe
AtheL BQJeW WQBCI WJUVe TUJhe DeEIV hUWte IYhUV EIAUV
MteFI teQBY QVtUV MeTIA UVMte FQVEe BthIV theJU XeTtU
AeIVT WhQMF TthUW hILLe VtheW tMTeV tWChQ JIUFe TtQFe
IHeth eFeYt MBeBQ QAUAA eTUIt eFSCe Bethe AWeFH eWJUV
eTUVI TTUtU QVthe LBQJe WWQBC IWJUV eTUJh eWhUB KeTeX
LFIUV UVEIT UJJUY MFtLI WWIEe QBUJh eJIUF eTtQE etthB
QMEht heWSF FIDMW heCIW JUVeT UJheF eJtth eYUtS JQBIT
ISCUt hQMtt UeBeY tQBWL eBAUW WUQVI VTUJh eAIBB UeTCI
WIFFQ CeTQV FSQVe TISQJ JJQBt heLMB LQWet heYUt SJQBU
tWLIB ttQQK IhIVT UVYQV tBQFF UVEth eLBQJ eWWQB WIVTt
heSCe BeJQB YeTtQ tIKeI VQIth VQttQ FeIHe DQFQE VIUVW
eIBYh QJAQB eFMYB ItUHe QBFeW WQVeB QMWLQ WtWXX
9/09/2015
![Page 9: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/9.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 9
• Now, you should use various clues. For example, Q is likely a, I, o or n. tQthe occurs several times. Here “the” is probably either a word of the beginning of another word (like “thermometer”). If so, then tQ is probably to, so Q=o.
• After trying for a while, you will recognize certain words, and so on. Eventually you find
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 zI D Y T O J E Z U P K F A V Q L G BWRM H C X S N9/09/2015
![Page 10: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/10.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 10
• And, the plaintext?The professors at Bologna were kept in absolute and even
humiliating subservience to their students. They had to swear obedience to
the student rectors and to the student-made statutes, which bore very
hardly upon them. The professor was fined if he began his teaching
a minute late or continued a minute longer than the fixed time, and
should this happen the students who failed to leave the lecture-room
immediately were themselves fined. In addition, the professor was
fined if he shirked explaining a difficult passage, or if he failed to get
through the syllabus; he was fined if he left the city for a day without
the rector’s permission, and if he married, was allowed only one day
off for the purpose. The city, for its part, took a hand in controlling the
professors, and they were forced to take an oath not to leave Bologna
in search of more lucrative or less onerous posts.
9/09/2015
![Page 11: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/11.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 11
Affine cipher
• This is an especially simple substitution cipher (also called Caesar cipher)
• It is an especially simple cipher, but we need just a little bit of math.
9/09/2015
![Page 12: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/12.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 12
Modulus arithmetic
• n: an integer• means • For example, 13 because 10| (13-3)=10
9/09/2015
![Page 13: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/13.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 13
• Consider A,B,C,…, Z as 26 numbers 0,1,2,…, 25.
• Choose two numbers a,b. (a should be prime to 26, which means their greatest common divisor is 1.)
• X→ aX+b• Remark: It is very important that a is prime
to n. If not, then X→ aX+b is not one-to-one, thus it doesn’t make a proper cipher.
9/09/2015
![Page 14: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/14.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 14
• For example, suppose a=5, b=1.• If the plaintext is ABC,• A=0, 5=B• B=1, 5G• C=2, 5=L• ABC→BGL
9/09/2015
![Page 15: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/15.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 15
Deciphering an Affine Cipher
• An affine cipher is a kind of substitution cipher. So, you can make a table of permutation given by aX+b. But, there is a faster way (in this art, speed is everything).
• Here’s another reason why a should be prime to n. (If you are using the English alphabet, n=26.) If a is prime to n (and only then), there is an integer a’ so that
9/09/2015
![Page 16: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/16.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 16
• Then, deciphering is done by• Y → a’(Y-b) (why?)• And, also, two questions:
1. If you are an eavesdropper Eve, how would you find the key of an affine cipher which you are eavesdropping?
2. Suppose you know the key a. How do you find its inverse a’?
9/09/2015
![Page 17: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/17.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 17
• You can use the brute force calculation, but there’s a smarter way, and it’s called the Euclidean algorithm. We will revisit this topic when we study RSA.
9/09/2015
![Page 18: Lecture 2 9/09/2015Math 3241. Substitution cipher Description: you permute the alphabet in a set way. (This permutation of the alphabet is the key of](https://reader035.vdocuments.us/reader035/viewer/2022072013/56649e735503460f94b728fe/html5/thumbnails/18.jpg)
4251 3
0011 0010 1010 1101 0001 0100 1011
Math 324 189/09/2015