You are on page 1of 35

Math 204 Conjectures & Proof in Discrete Mathematics Cryptography May Term 2012 Gustavo Chino Notes

30 April 2012 Day 1 Cryptograms P ain Te!t "PT#$ Cipher Te!t "CT#$ origina message% enco&e& message%

'ometimes (or& )rea*s are preserve&% +easier to &ecipher if that is the case, once one etter is figure& out it-s going to remain )eing that etter for the entire cipher% Mono.a pha)etic ciphers$ invo ves etter for etter su)stitution% Cipher$ co&e$ encrypting etters encrypting (or&s% "(e- )e &ea ing (ith the former on y#

'trategies emp oye& for /ctivity 1$ Try to first &ecipher the sma er repeate& (or&s figure out the vo(e s use *no( e&ge on common sma (or&s guess an& chec* never hurts etter fre0uency a so he ps on onger ciphers% -1- is most common etter use& in 1ng ish anguage% 2eep a ist of the etters figure& out "ie$ D 33 45 etc%# Pay attention to apostrophes an& other punctuation% / 6itt e 7ac*groun& 8istory 1ar iest recor&e& type of cipher &ates )ac* to 90 7C% 7ac* to :u ius Caesar% ;se& a shift cipher < a = shift% e!% C>?/@D' 33 4@AD;GB To &ecrypt move every etter )ac* three since it-s a = shift% 'trategies emp oye& for /ctivity 2$ 7rute force attac*C Try a the possi)i itiesC " on y 29D2E of them%# 6etter fre0uency% @epeate& etter patterns " .ing5 the are very common% Dou) e etters% "&ou) e &-s5 t-s5 s-s5 -5 etc% are common%#

'hift Ciphers$ converting to a mathematica formu a 4irst5 convert to a mathematica formu a% Convert from etters to num)ers% /F0G 7F1G HG AF29 CT 3 f "PT#G Caesar cipher 33I = shift% CT 3 PT J = PT CT K>; F$ 24 14 20 L L 7@M F $ 1 1N 2=

2E O 0 mo& 2E 2N O 1 mo& 2E 2P O 2 mo& 2E Mo&u ar /rithmetic Definition 1$ Congruence mo& n &escri)es (rapping aroun& mo& n% n nJ1 nJ2 O 0 mo& n O 1 mo& n O 2 mo& n H

e!amp es =9 3 2EJQ O 0 JQ O Q mo& 2E E0 3 2EJ2EJP O P mo& 2E E0 O 2EJP O =4 mo& 2E Definition 2$ Ra5)5n S a O ) "mo& n# if a an& ) have the same remain&er (hen &ivi&e& )y n% Theorem$ Tsi&e noteT 3 the set of a integers comes from UVah enW (hich is German for num)ers%

The Division Princip e R)5 n5 05 r S n I 0 There e!ists a uni0ue 05 r5 such that ) 3 0n J r an& 0 X r Y n%

Definition =$ Ra5)5n5 * S a O ) "mo& n# if a < ) 3 n* for some *%

Definition 4$ Ra5)5n5 * S a O ) "mo& n# if a 3 ) J n* for some *% 1!$ 129 O =1 mo& 12Z )y &ef =$ 129.=1 O 12* Q4 CO 12*% No% ?ith four &efinitions5 (e shou & re.verify that a &efinitions are e!act y the same% Defn 1 33 Defn 2 [f Defn 1 is true 33I Defn 2 is true% [f Defn 2 is true 33I Defn 1 is true% Defn 1 if an& on y if Defn 2% TDD/si&e 'tatement$ [f / then 7% Contrapositive$ [f not 7 then not /% The previous (ere e0uiva ent statements% The procee&ing one (i not )e e0ua % Converse$ [f 7 then /%DDT 'ho( Defn1 3I Defn 2 /ssume a O ) mo& n as in Defn1% a 3 nJnJnJ%%%n J)% "prece&ing the -J)- is a -*- amount of n-s%# a 3 n* J ) 0 X ) Y n% -)- is the remain&er of -a- (hen &ivi&e& )y n5 so -a- an& -)have the same remain&er (hen &ivi&e& )y n% 'ho( Defn2 3I Defn1 /ssume a O ) mo& n as in Defn2% -a- an& -)- have the same remain&er (hen &ivi&e& )y n% a 3 0n Jr ) 3 pn Jr (here 0 I p% a 3 n J %%%n J r "n5 0 amount of times#% ) 3 n J %%%n Jr "n5 p amount of times#%

r 3 ) < "n J %%%n#% a 3 "nJ%%%n# J ") < "nJ %%%n##% a 3 n J %%%n J ) "the n-s are no( there the e0uiva ent of 0 . p times#% 1 May 2012 Day 2 Theorem$ for Ra5 )5 c5 n S5 n I 0 a O ) mo& n iff aJc O )Jc mo& n% 'hift Ciphers 4ormu a for encryption$ CT O PT J ' mo& 2E% ' 3 R05 15 25 %%%29S TD Note that 0 (i resu t in a )a& encryption DT 4or &ecryption$ PT O CT < ' mo& 2E% Mu tip ication Cipher CT 3 MTPT mo& 2E 1!amp e using a mu tip ier of =% e!% CT O =PT mo& 2E PT 3I ;'1 C>D1 7 converte& to num)ers that is$ 20 1P 4 2 14 = 4 1 ; converte& (ou & )e$ CT O ="20# mo& 2E O E0 mo& 2E O P mo& 2E $ CT 3 [% ' converte& (ou & )e$ CT O ="1P# mo& 2E O 94 mo& 2E O 2 mo& 2E $ CT 3 C% Done for a etters in the p ain te!t (e get the cipher$ U[CMG\:MDW

[f instea& of a mu tip ier of = (e use 25 (e get U>2[1CG[CW for the CT% C ear y5 there is no (ay to &ecrypt that since t(o &ifferent etters encrypt as -C-% 2 is not a goo& mu tip ier% =5 on the other han&5 (or*s just fine% K/KC

Conjecture [f -a- an& 2E have a factor in common then -a- is not a goo& mu tip ier% [f -a- an& 2E &o not have factors in common then it (i )e a goo& mu tip ier%

1ncryption$ To &ecrypt$

CT O =PT mo& 2E ; ' 1%%% 20 1P 4%%% P 2 12%%% [ C M%%%

?e (ou & assume that to &ecrypt (e (ou & &ivi&e since (e mu tip y to encrypt% ?e (ou & )e (rong5 though% Division isn-t rea y possi) e in mo& arithmetic% [n or&er to &ecrypt te!t (e (ou & have to fin& (here$ =M O 1 mo& 2E% ?e fin& that (ith M 3 =5 O 1 mo& 2E% ;sing this%%% P T Q 3 N2 O 20 mo& 2E% 2 T Q 3 1P O 1P mo& 2E% 12 T Q 3 10P O 4 mo& 2E% 'o5 QCT O QT= PT mo&2E O PT mo& 2E% Q is the mu tip icative inverse of =5 an& vice versa% Mu tip icative [nverse Definition$ M is the mu tip icative inverse of a mo& n5 if aTM O 1 mo& n%

CT 3 a PT mo& 2E a 3 R15 =5 95 N5 Q5 115 195 1N5 1Q5 215 2=5 29S There are 12 mu tip icative ciphers for mo& 2E% [nverses for mo& 2E$ 1F1 =FQ 9 F 21 N F 19 11 F 1Q 1N F 2= 29 F 29

/ffine Cipher CT 3 aPT J ) mo& 2E ] ] 12 2E &ifferent num)er of possi)i ities for each% Tota num)er of ciphers possi) e is 12 T 2E < 1 ] or (hen a 3 1 & ) 3 0% [n or&er to &ecrypt$ if CT O NPT mo& 2E CT < 20 O NPT mo& 2E 19"CT.20# O PT mo& 2E%

19 )eing the mu tip icative inverse of N% CT O aTPT J ) mo& n CT < ) O aTPT mo& n M"CT < )# O PT mo& n%

[n genera $

-M-5 of course )eing the mu tip icative inverse of -a- (ith respect to -n-% 6etter to Num)er Converter% / 7 C D 1 4 G 8 [ : 2 6 M N > P \ @ ' T ; B ? M K A

0 1 2 = 4 9 E N P Q 10 11 12 1= 14 19 1E 1N 1P 1Q 20 21 22 2= 24 29

3 May 2012 Day 3 Conjecture$ / num)er5 a5 has a mu tip icative inverse mo& n if an& on y if gc& "a5 n# 3 1% TDD/si&e$ gc& 33 greatest common &ivisor% DDT Definition$ Definition$ Definition$ The gc& "a5 n# 3 & if & &ivi&es a an& & &ivi&es n an& & is the argest common &ivisor of a & n% That is5 e^a "e &ivi&es a# an& e^n then e X &% [f gc& "a5 n# 3 1 then a & n are relatively prime% [f p I 1 has on y &ivisors 1 an& p then p is prime%

The 1u er Phi 4unction Definition$ _"n# counts a the num)ers )et(een 1 an& n that have no factors5 e!cept 15 [n common (ith n% "re ative y prime (ith n#% The num)er of va i& "&ecrypt.a) e# affine ciphers mo& n 3 _"n# T n < 1%

Theorem$

Proof$ _"n# is the num)er of va i& mu tip iers an& n is the num)er of va i& shifts% ?e su)tract 1 for the case a 3 15 ) 3 0% 'o ving /c < = [nstea& of thin*ing of so ving the pro) em as CT 3 aPT J ) mo& 2E it5 instea&5 might )e easier to thin* of it as PT 3 aCT J) mo& 2E% ;sing the fre0uency of etters in the cipher5 4 an& D )eing the most use&5 an& the fact that 1 an& T are the most common etter use& in the 1ng ish anguage then it (ou & )e safe to assume that$ CT 4 "9# D "=# F F PT 1 "4# T "1Q#

[t-s5 for the most part5 just tria an& error% Guess an& chec* ti you fin& the correct a an& )% Converting the previous guess into t(o formu as (e get$ 4 O a9 J ) "mo& 2E# 1Q O a= J ) "mo& 2E# su)tracting one from the other5 (e get$ 19 O .2a mo& 2E or 19 O 24a mo& 2E% This converte& (ou & )e$ 19 3 24a J2E*% This has no so utions5 though5 )ecause 2 an& 2E are )oth even an& no matter the com)inations of a an& *-s they (ou & never e0ua an o&& num)er5 or more specifica y5 19% PT1 < PT2 O "CT1 < CT2#a mo& 2E

Theorem$

[f the pair of e0uations$ PT1 O aCT1J ) mo& 2E PT2 O aCT2 J ) mo& 2E has a so ution that so ution correspon&s to a va i& affine encryption formu a5 then "PT1 < PT2# an& "CT1 < CT2# must )e )oth even or )oth o&&%

Proof$ 'u)tracting one e0uation from the other PT1. PT2 O a"CT1 < CT2# mo& 2E using Definition = of Mo&u ar /rithmetic$ "PT1. PT2# . a"CT1 < CT2# 3 2E* for some * % -a- is a va i& mu tip ier for an affine cipher5 so gc& "a5 2E# 3 1% [n particu ar5 a is o&& "a ` 1=#% TDDNote$>&&T>&&3>&&% >&&T1ven31ven%DDT /ssume$ "CT1 < CT2# is o&&% 'o5 a"CT1 < CT2# is a so o&&% "PT1. PT2# 3 2"1=*# J a"CT1 < CT2# L L even o&& Thus5 "PT1. PT2# must )e o&& since even J o&& 3 o&&% No( assume$ "CT1 < CT2# is even% 'o5 a"CT1 < CT2# is a so even% "PT1. PT2# 3 2"1=*# J a"CT1 < CT2# L L even even Thus5 "PT1. PT2# must )e o&& since even J even 3 even% ?ith that in min&5 (e no( go )ac* to trying to so ve /c < =% CT 4 "9# D "=# F F PT 1 "4# / "0#

4 O 9a J ) mo& 2E 0 O =a J ) mo& 2E 4 O 2a mo& 2E a 3 2 mo& 2E%

'ince the 2 an& the 4 are )oth even then there is more than one so ution% 'o5 (e ta*e 4 O 2a mo& 2E an& convert it to$ 4 3 2a J 2E*% ?hich5 (e then simp ify to$ 2 3 a J 1=*% ?hich is then transforme& to$ a O 2 mo& 1=% The so utions5 no( c ear y visi) e5 are a 3 195 2 mo& 2E% @ea iVing that 2 is an inva i& a for an affine cipher5 (e move on to the 19% ?e p ug in a 3 19 to one of the functions$ 0 O =T19 J ) mo& 2E ) O .49 mo& 2E5 or ) O N mo& 2E% PT 3 19 CT J N mo& 2E% No( the on y thing eft to &o is to chec* if it (or*s or not% [f it &oesn-t then (e go )ac* an& try &ifferent ettersDnum)ers for PT1 an& PT2% 6etter 4re0uency$ 4rom most to east% 15 T5 /5 >5 [5 N5 '5 85 @5 D5 65 C5 ;5 M5 ?5 45 G5 K5 P5 75 B5 25 :5 A5 \5 A% 1!amp es$ 4! O 10 mo& 20 4! 3 10 J 20* 2! 3 9 J 10* 1ven ` >&&% No 'o utions% 1asier (ay of figuring this out$ gc& "45 20# 3 4 )ut 4 &oes not &ivi&e into 10%

P! O 12 mo& 20 gc& "P5 20# 3 4 P! 3 12 J 20* 4^12 2! 3 = J 9* ="2! O = mo& 9# Convert to mo&% Mu tip y )y = )ecause it-s M[ of 2% ! O Q mo& 9 or ! O 4 mo& 9% ! 3 4 J 9* * 3 05 ! 3 4 * 3 15 ! 3 Q * 3 25 ! 3 14 * 3 =5 ! 3 1Q * 3 45 ! 3 24 O 4 mo& 20% E! O Q mo& 12 gc& "E5 12# 3 E% E &oes not &ivi&e into Q%

4 so utions mo& 20$ 45 Q5 145 1Q% E! O Q mo& 20 gc& "E5 20# 3 2% 2 &oes not &ivi&e into Q%

12! O 20 mo& =2 12! 3 20 J =2* =! 3 9 J P* =! O 9 mo& P ="=! O 9 mo& P# ! O 19 mo& P ! O N mo& P ! 3 N J P*% 4 May 2012 Day 4 Theorem$

gc& "125 =2# 3 4% 4^12 = is the M[ of =% ! 3 N5 195 2=5 =1 mo& =2

4or any integer5 * a 1 _"2b*# 3 2b"* < 1#%

Proof$ Consi&er the set of num)ers R15 25 =5 45 H5 2b*S% 'ince5 2b* is a po(er of 25 the on y (ay a num)er (i have a factor in common (ith 2b* is if the factor is some po(er of 2% This means a num)ers (i have a factor in common (ith 2b*% Thus5 the num)ers (hich &o not have a factor in common (ith 2b* are e!act y a the o&& num)ers in the set R15 25 =5 H5 2b*S% 1!act y ha f of the num)ers (i )e o&&% Thus5 _"2b*# 3 c"2b*# 3 2b"* < 1#% Theorem$ _"=b*# 3 2T=b"* < 1#%

Proof$ Consi&er the set R15 25 =5 H5 =b*S% The on y num)ers that (i have a factor in common (ith =b* are mu tip es of =5 that is R=5 E5 Q5 H5 =b*S% 'ince5 every thir& num)er is a mu tip e of =5 this means a thir& of the num)ers in the set (i have a factor in common (ith =b* an& t(o thir& of the num)ers (i )e re ative y prime% _"pb*#5 (here p is prime% _"pb*# 3 ""p < 1# D p#T"pb*# 3 "p < 1# T pb"* < 1# 3 "pb*# < "pb"* < 1## Theorem$ 1 J H J n < 1 "mo& n# F if n is even O nD2 "mo& n#5 if o&& O 0 "mo& n#%

Proof$ 'uppose n is even% 1 J 2 J H Jn < 1 "mo& n# O 1 J 2 J H J nD2 J H J "n < 2# J "n < 1# "mo& n# dd DD dd DD "n < 1#D2 "n < 1#D2 @egrouping$ O "1 J n < 1# J "2 J n < 2# J H H"nD2 < 1 J nD2 J 1# J "nD2# "mo& n# O n J n J HJ n J nD2 "mo& n# O nD2 "mo& n#%

No(5 suppose n is o&&% 1 J 2 J H Jn < 1 "mo& n# O "1 J n < 1# J "2 J n < 2# J H ""n < 1#D2 J "n J 1#D2# "mo& n# O n J n J n J HJ n "mo& n# O 0 "mo& n#% >@$ 1 J 2 J = J H J n < 1 "mo& n# O ""n < 1# n#D2 "mo& n# if n is even5 n < 1 is o&&% "n < 1# "nD2# "nD2# if n is o&&5 n < 1 is even% ""n < 1#D2# T n "n < 1#D2 ""n < 1#D2# T n O 0 "mo& n# since ""n < 1#D2# is an integer%

"n < 1# "nD2# O .1"nD2# "mo& n# O .1"nD2# J n "mo& n# O nD2 "mo& n#% Theorem$ =! O 1 "mo& n# (here n 3 =*5 for some * 5 has no so ution%

Proof$ 7y &efinition 45 =! O 1 "mo& n# if =! 3 1 Jnl for some l since n 3 =* for some * so5 =! 3 1 J =*l =! < =*l 3 1 ="! < *l# 3 1 "! < *l# There is no integer5 (5 such that =( 3 1% That is5 = &oes not &ivi&e 1% 'o5 there is no possi) e so ution% Mono.a pha)etic Ciphers$ 6etter for etter su)stitution same etter gets encrypte& same (ay no matter (here it occurs in the CT cryptograms "some preserve (or& )rea*s# shift ciphers "e 29# affine ciphers "=11 F 12T2E.1# @an&om /ssignment$

7rute force attac*s are not going to (or*% ?hyZ 7ecause there are 2ECD29C &ifferent possi)i ities (hen attempting these% Difficu t as fuc*%

2ey(or& Mono.a pha)etic Ciphers ;ses a *ey(or& to set an a pha)etic cipher% [e using -M/T81M/T[C''ince there are repeat etters (e instea& use -M/T81[C'- then assign the ne!t etters in a pha)etic or&er s*ipping the ones (e-ve a rea&y use&$ / 7 C D 1 4 G 8 [ M / T 8 1 [ : 2 6 M N > P \ @ ' T ; B ? M K A

C ' 7 D 4 G : 2 6 N > P \ @ ; B ? M K A

@ight a(ay (e see a pro) em arise% Mu tip e etters encrypt as themse ves an& some have )ig spans (here they are in or&er% [nstea& (e cou & use$ 2ey(or& Co umnar Transposition% M 7 > K / D P A T 4 \ 8 G @ 1 : ; [ 2 B C 6 ? ' N M

The cypher is then create& )y isting the etters from up to &o(n5 co umn )y co umn$ / 7 C D 1 4 G 8 [ : 2 6 M N > P \ @ ' T ; B ? M K A

M 7 > K / D P A T 4 \ 8 G @ 1 : ; [ 2 B C 6 ? ' N M 8o( to Crac* Mono.a pha)etic Ciphers$ 4re0uency ana ysis if message is ong enough or e se &ata is (orth ess

Most common &ou) e etters$ 5 ee5 ss5 oo5 ff5 tt Most common &igraphs$ th5 he5 in5 er5 an5 re5 n&5 at5 on5 nt5 ha5 es5 st5 en%%% Most common trigraphs$ the5 ing5 tha5 ent5 ion5 tio5 for5 n&e5 has5 nce Most common starting etters$ toa()c&sfm 8a f of a (or&s en& in$ e t & s% 'ome 8istorica 7ac*groun&$ ?e are aroun& the 1E00-sD1N00-s in the historic time. ine% 4re0uency ana ysis came a)out in the E00-s% The /ra)s stum) e& upon it )y stu&ying the 2oran in or&er to chrono ogica y organiVe Mohamme&-s te!ts% They starte& (ith (or& fre0uencies (hich e& to etter fre0uency counts% 1ventua y this e& to )eing use& for ciphers% 1urope (as in the Dar* /ges (hen most of this came a)out% ;ses statistica an& inguistic e ements% Po y.a pha)etic Ciphers$ same etter can get encrypte& in a &ifferent (ay at a &ifferent p ace in the cipher te!t Bigenere Cipher < uses *ey(or&s to &etermine mu tip e shift ciphers Biganere '0uare
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 0 A B C D E F G H I J K L M N O P Q R S T U ! " # $ 1 B C D E F G H I J K L M N O P Q R S T U ! " # $ A 2 C D E F G H I J K L M N O P Q R S T U ! " # $ A B 3 D E F G H I J K L M N O P Q R S T U ! " # $ A B C 4 E F G H I J K L M N O P Q R S T U ! " # $ A B C D 5 F G H I J K L M N O P Q R S T U ! " # $ A B C D E 6 7 8 9 10 G H I J K H I J K L I J K L M J K L M N K L M N O L M N O P M N O P Q N O P Q R O P Q R S P Q R S T Q R S T U R S T U S T U ! T U ! " U ! " # ! " # $ ! " # $ A " # $ A B # $ A B C $ A B C D A B C D E B C D E F C D E F G D E F G H E F G H I F G H I J 11 L M N O P Q R S T U ! " # $ A B C D E F G H I J K 12 M N O P Q R S T U ! " # $ A B C D E F G H I J K L 13 N O P Q R S T U ! " # $ A B C D E F G H I J K L M 14 O P Q R S T U ! " # $ A B C D E F G H I J K L M N 15 P Q R S T U ! " # $ A B C D E F G H I J K L M N O 16 Q R S T U ! " # $ A B C D E F G H I J K L M N O P 17 R S T U ! " # $ A B C D E F G H I J K L M N O P Q 18 19 20 21 22 S T U ! T U ! " U ! " # ! " # $ ! " # $ A " # $ A B # $ A B C $ A B C D A B C D E B C D E F C D E F G D E F G H E F G H I F G H I J G H I J K H I J K L I J K L M J K L M N K L M N O L M N O P M N O P Q N O P Q R O P Q R S P Q R S T Q R S T U R S T U 23 " # $ A B C D E F G H I J K L M N O P Q R S T U 24 # $ A B C D E F G H I J K L M N O P Q R S T U 25 $ A B C D E F G H I J K L M N O P Q R S T U

! ! " ! " #

To 1ncrypt$ 1st ine is the PTG 1st co umn is the 'hift% CT is (here they intersect% To Decrypt$ Do(n the 1st co umn to the shift then right to the CT% Then move up for the PT% 1!amp e$ 2ey(or&$ 21K PT$ 8 1 6 6 > shift$ 2 1 K 2 1 CT$ @ [ : B ' 7 May 2012 Day 5 8o( to &etermine if a te!t is mono.a pha)etic or po y.a pha)etic$ Mono.a pha)etic Po y.a pha)etic . 4re0uency &istri)ution shou & oo* oo* a ot i*e in 1ng ish% "or (hatever anguage you may )e current y using%# . 'hou & )e more of an even &istri)ution that mono% [n&e! of Coinci&ence in of Cipher Te!t$ Pro)a)i ity that t(o etters5 pic*e& at ran&om form a cipher te!t5 are i&entica % Definition$ 1!amp e$ The pro)a)i ity of an event occurring is "rDn# (here n is the tota num)er of outcomes an& r is the num)er of (ays that event can occur% Consi&er the set$ /7CD1 using the *ey(or& an& the a)ove metho& (e get$

Pro)a)i ity of pic*ing / if (e pic* one etter$ 1D9 Pro)a)i ity of pic*ing a vo(e if (e pic* one etter$ 2D9 Pro)a)i ity of pic*ing a consonant if (e pic* one etter$ =D9 or 1.2D9 1!amp e$ 'uppose (e (ant to pic* 2 etters from the set R/5 75 C5 D5 1S ?e have t(o options$ 1# 'uppose (e pic* a etter5 rep ace it5 an& pic* a secon& etter% 2# Pic* )oth etters at once "repeats are not a o(e&#% Pro)a)i ity of pic*ing / then 7$ >ption 1$ pro) of pic*ing -/- T pro) of pic*ing -71D9 T 1D9 3 1D29 >@D1@ M/TT1@'%

Pro)a)i ity of pic*ing / an& 7$ >ption 2$ 7 first then / >@ / first then 7

1D9 T 1D9 J 1D9 T 1D9 3 2D29 >@ 33 -J- /ND 33 -T1!amp e$ 8o( many (ays to pic* t(o etters from a set of 9$ 1# Pic* a etter5 rep ace it5 then pic* another etter$ 9 (ays T 9 (ays 3 29 tota % 2# Pic* )oth etters (ithout rep acing the first$ 9 (ays T 4 (ays 3 20 tota "if or&er matters# 10 tota 3 20D2 "if or&er &oesn-t matter#% 8o( many (ays to pic* three etters from a set of 9$ >r&er matters$ 9 T 4 T = 3 E0% >r&er &oes not matter$ E0 D E 3 10% ?hy &ivi&e )y E (hen (e &ivi&e& )y 2 the first timeZ )ecause of the many &ifferent (ays there are to or&er = an& 25 respective y% There are E for =% =C 3 = T 2 T 1 3 E% /n& 2 for 2% 2C 3 2 T 1 3 2% Permutations P"n5 r#$ Definition$ P"n5 r# is the num)er of to choose r o)jects from a set of n o)jects (here order matters. P"n5 r# 3 n T "n < 1# T H T "n < r J 1# 3 nCD "n.r#C Com)inations C"n5 r#$ Definition$ C"n5 r# is the num)er of (ays to pic* r o)jects from a set of n o)jects (here or&er &oes NOT matter% C"n5 r# 3 P"n5 r# D rC 3 nC D ""n < r#C T rC# 1!amp e$ 4in& the num)er of (ays to pic* = movies from a set of 10% . >r&er &oes not matter . C"105 =# 3 10C D "NC T =C# 3 "10 T Q T P#D"= T 2 T 1# 3 120%

.>r&er matters. P"105 =# 3 10C D NC 3 10 T Q T P 3 N20% Cipher Te!t CT$ /CD71/D17//1C7/ /$ 95 7$ =5 C$ 25 D$ 25 1$ =

Pro)a)i ity of pic*ing 2 i&entica etters (hen 2 etters are pic*e& at ran&om at the same time% ">r&er &oes not matter%# Tota num)er of (ays to pic* t(o etters$ C"195 2# 3 19 T 14 D2 3 109% Tota num)er of (ays to get i&entica etters$ 2 /-s$ 2 7-s$ 2 C-s $ 2 D-s$ 2 1-s$ C"95 2# 3 9 T 4 D2 3 10 C"=5 2# 3 = T 2 D2 3 = C"25 2# 3 2 T 2 D2 3 1 C"25 2# 3 2 T 2 D2 3 1 C"=5 2# 3 = T 2 D2 3 =

Pro)a)i ity of pic*ing 2 i&entica etters$ 3 " C"95 2# J C"=5 2# J C"25 2# J C"25 2# J C"=5 2# # D C"195 2# 3 1P D 109 3 1N%1 f Definition$ [n&e! of Coinci&ence < pro)a)i ity of pic*ing 2 i&entica etters (hen 2 etters are pic*e& at ran&om "same time#% =%P9 f is the in&e! of coinci&ence for an even y &istri)ute& te!t% "6arge te!t#% "Guess$ Bigenere shou & )e c ose to this%# /nother (ay to compute in&e! of coinci&ence for arge te!ts Ca cu ate pro)a)i ity (ith rep acement of etters% Note$ sti even y &istri)ute&% Pro)a)i ity of pic*ing an /$ 1D2E Pro)a)i ity of pic*ing t(o /-s$ 1D2E T 1D2E Pro)a)i ity of pic*ing an& 2 i&entica etters$ "1D2E T 1D2E# T 2E 3 1D2E

Computing the in&e! of coinci&ence for the 1ng ish 6anguage$ pro)a)i ity of pic*ing 2 /-s$ "%0P1EN#b2 pro)a)i ity of pic*ing 2 7-s$ "%014Q2#b2 % % % pro)a)i ity of pic*ing 2 A-s$ "%000N4#b2 3 %0E9 3I J J J E%9 f

33I [n&e! of Coinci&ence for a mono.a pha)etic cipher% 8 May 2010 Day 6 1!p anation of gE on the previous nights home(or*$ The pro) em seems to oo* a )it i*e pasca s triang e (hich is use& in 7inomia 1!pansion% ";sing the 7inomia Theorem%# 7inomia 1!pansion$ "! J y# bn 3 C"n5 0# T !bn T yb0 J C"n5 1# T !b"n < 1# T yb1 J H J C"n5 n# T !b0 T ybn% 6et ! 3 1& y 3 1G "1J1#bn 3 2bn 3 C"n5 0# J C"n5 1# J H JC"n5n# Crac*ing Bigenere Ciphers$ G>/6$ 4in& the ength of the *ey(or& for Bigenere ciphers% Then (e can use fre0uency ana ysis on each co umn as each co umn is a simp e shift cipher%

8o( (i (e accomp ish these tas*sZ ;sing the 4rie&man Test an& the 2asis*i Test% 4rie&man Test$ ?e (ant to compute the in&e! of coinci&ence in t(o (ays$ 1# 2# " h C"n5 2## D C"N5 2# n 3 num)er of ath etters in CT% N 3 tota num)er of etters%

/ssume the *ey(or& has ength * an& )rea* cipher te!t into * co umns an& compute the [n&e! of Coinci&ence as a function of *%

No( (e$

/ssume the cipher te!t has N etters an& * ^ N%

1ach co umn (i just )e a shirt (ith fre0uency &istri)ution same as the a pha)et of the anguage that is )eing use&% Compute the [n&e! of Coinci&ence )y 1# ca cu ating the pro)a)i ity of pic*ing t(o i&entica etters in the same co umn an& )y 2# pic*ing t(o i&entica etters in 2 &ifferent co umns% [oC (ay g2$ 1# Num)er of (ays to pic* t(o i&entica etters from t(o &ifferent co umns$ 3 " g of (ays to pic* 2 co umns# T "g of (ays to pic* 2 i&entica etters 3 C "*5 2# T "g of (ays to pic* 2 etters# T " pro)a)i ity of pic*ing i&entica etters in an even y &istri)ute& te!t%# 3 C "*5 2# T "N D *#T"N D *# T "%0=P9# 2# Num)er of (ays to pic* t(o i&entica etters from the same co umn$ 3 " g of (ays to pic* a co umn# T "g of (ays to pic* t(o i&entica etters from the same co umn# 3 * T "g of (ays to pic* t(o etters# T "pro)a)i ity of pic*ing i&entica etters# 3*T C""N D *#5 2# T "%0E9#

'o5 [C 3 C"*5 2# "N D *# "N D *# "%0=P9# J * T C""N D *#5 2# "%0E9# # D C"N5 2# H 'o ve for * H * e "%02E9N#D ""N < 1# [C J %0E9 < %0=P9N# 4rie&man Test% 2asis*i Test$ 6oo* for repeats an& &istance )et(een repeats% Then chec* for common factors in the &istances )et(een the repeate& patterns% ;se& (ith 4rie&man Test to )rea* Bigenere Ciphers% Perfect 'ecurity$ Bigenere cipher (here the *ey(or& is as ong as the cipher te!t5 an& the *ey(or& is ran&om5 is sai& to have perfect securit% 1!amp e$ CT: K: PT: RCDMESVDJI FOIEAFNXCP MOVIENIGHT

K: PT: K: PT:

FOIEAKDCJF MOVIEISBAD LLZMLGHIBE GREATMOVIE

[f (e try a possi) e *ey(or&s5 then5 (e can get any string of 10 etters as the possi) e p ain te!t% 10 May 2012 Day 7 'econ& Po y.a pha)etic Cipher$ / )erti-s Cipher ?hee "14EEDN# < 'imi ar to Bigenere e!cept you rotate (hee to encrypt &ifferent etters (ith &ifferent mono ciphers% < /) e to use a cipher (hee to encrypt a Bigenere cipher instea& of a Bigenere s0uare% The 1nigma Machine$ / ??[[ cipher machine use& )y the NaVis% [t is a very comp icate& po y.a pha)etic cipher% [nvente& in 1Q1P )y /rthur 'cher)ius5 a German inventor an& e ectrica engineer% [t is a mechaniVe&5 e ectrica 5 an& e!pan&e& version of the / )erti cipher (hee % 8o( &oes it (or*Z$ [t has a *ey)oar& an& a comp icate& scram) ing unit that consists of a p ug)oar&5 rotors5 an& a ref ector% The 'cram) ing ;nit$ [t-s a comp icate& system of assigning a etter to a &ifferent etter5 then changing the system for the ne!t etter that is getting scram) e&% P ug)oar& < '(aps etters that are (ire& together% @otors < 1ach rotor has a permutation of the a pha)et "each can )e remove& an& put in &ifferent ocations%# @ef ector < Ma*es the encryption an& &ecryption process the same% 11 May 2012 Day 8 8o( Many 'ettings for the 1nigmaZ 4or our paper 1nigma$ =C 3 E (ays to arrange the rotors% 2Eb= 3 1N9NE possi) e settings for a three rotors% E T 1N9NE 3 109549E%

Tota Num)er of 'ettings$ 4ive rotors to choose from5 choose on y three of them% P"95=# 3 E0% [nitia three etter settings for rotors 3 2Eb= 3 1N9NE% Tota 3 E0 T 1N9NE T 1%00=Q1P111 3 1%09PN11N Num)er of com)inations for 2E etters5 * p ugs$ C"2E5 2# C"245 2# HC"2E < 2"* < 1#5 2# *C 2EC 2b* T *C T "2E < 2*#C 'ecurityZ$ The Germans )e ieve& 1nigma (as un)rea*a) e )ecause of its seeming y infinite (ays to set it up% Po ish an& 7ritish cryptana ysts5 though5 eventua y succee&e& in &eciphering some messages < most y from human errors in usage of machine an& the use of cri)s% "Guessing ho( PT an& CT correspon&%# /ttac*s$ The first to attac* (ere Po ish cryptographers5 especia y @eje(s*i5 a mathematician using properties of permutation groups% Previous y most cryptana ysts (ere inguists )ut (ith the a&vent of the 1nigma an& other cryptographic machines the po(er of mathematics )ecame more apparent% The 4rench shou & have )een the first to attac* 1nigma as they receive& information from a German spy (ho provi&e& &ocuments that &escri)e& ho( the 1nigma machine (or*e&% "Minus the (iring of the rotors%# They thought it (as too har& to fin& the *ey% "Typica 4rench#% 4rance5 though5 share& the info (ith the Po es% Po an& (as e!pecting a German attac* any &ay so they ha& c ear motivation% They use& Permutation Theory to &etermine (iring% The Germans use& e a)orate co&e )oo*s (ith &ifferent settings for each &ay "(hich rotors5 (here the rotors start5 an& the p ug)oar& settings%# Then each message (ou & start (ith a three etter *ey to use for that specific message% This co&e (ou & )e repeate& t(ice to ensure correct transmission% That (as their &o(nfa % This repetition is e!act y (hat a o(e& @eje(s*i an& others the too s to crac* 1nigma% 1!amp e$ [[[5 [5 [B C/T /<4 G<2 % % % C<: @otors an& their or&er% Three etter *ey%

Message$

D>GD>G ?hich is encrypte& (ith the origina setting for the &ay% Then the *ey -C/T- is change& to -D>G-% Then the rest of the message is sent (ith the initia setting -D>G-%

Permutation of 6etters ";sing Day N 8? gN #$ The t(o 1=. etter chains from the 8? D cipher te!t$ "7.K.T.8.C.4.:.\.P.N.[.'.A# "2.?.D./.@.B.6.M.>.G.;.1.M# Pa$ Permutation on a 1st etters$ / 7 C D 1 4 G 8 [ : 2 6 M N > P \ @ ' T ; B ? M K A T B ? 8 \ 2 N D > M 4 A : G [ ; 1 K M / P 7 C ' @ 6

P&$ Permutation on a 4th etters$ / 7 C D 1 4 G 8 [ : 2 6 M N > P \ @ ' T ; B ? M K A 8 6 D C P ? [ / G 2 : 7 \ ; ' 1 M T > @ N K 4 A B M

P&"Pa# +Pa first then to P& for the fina output,$ / 7 C D 1 4 G 8 [ : 2 6 M N > P \ @ ' T ; B ? M K A @ K 4 / M : ; C ' \ ? M 2 [ G N P B A 8 1 6 D > T 7

Notice that the permutation a)ove corre ates (ith etter chain permutations% 2ey(or& )ase& on three etters$ k1 k2 k3 k1 k2 k3 CT1 CT2 CT3 CT4 CT5 CT6 CT1 3 Pa "*1# CT1 3 P& "*1# *1 3 Pa "CT1# *1 3 P& "CT4#

CT1 3 Pa "*1# P& "*1# 3 CT4 P& "Pa "CT1## 3 P& "*1# 3 CT4 P/ $ "/T# "7B# "C?# "P8# "1\# "42# "GN# "6># ":M# "6A# "P;# "@K# "'M# "@ea& as$ / goes to TG T goes to /% 7 goes to BG B goes to 7% etc%# @eje(s*i$ The cyc e structure of P&"Pa# (i a (ays )e pairs of cyc es that can )e matche& up to pro&uce Pa an& P&%

?or*ing in &ifferent )ases$ 7ase 2E$ 7CD14 F 3 3 +15 25 =5 45 9,)ase 2E 1T2Eb4 J 2T2Eb= J =T2Eb2 J 4T2Eb1 J 9T2Eb0 4Q42E9 in )ase 10 "a*a &ecima %#

Convert 12=49 to )ase 2E$

12=49 3 2Eb2 "1P# J 1NN 3 2Eb2 "1P# J 2E "E# J 21 3 +1P5 E5 21,)ase 2E 3'GB or$ 12=49 3 2E"4N4# J 21 4N4 3 2E"1P# J E 12=49 3 2E"2E"1P# J E# J 21 3 2Eb2"1P# J 2E"E# J 21

[n )ase 2E$ O N E ! T " O 14 13 4 !1# 22 14 1 $ # 1$ "(hen you a&& to 2E you just a&& one to the ne!t over on the eft# converting )ac* to etters the ans(er is$ 7 [ : ' 7inary < 7ase 2$ 01101101 < )inary% 3I Convert to &ecima % 0T2bN J 2bE J 2b9 J 0T2b4 J 2b= J 2b2 J 0T2b1 J 2b0 3 10Q Convert NP to )inary$ NP 3 2 "=Q# 3 2 "1 J 2"1Q## 3 2 "1 J 2"1 J 2"Q### 3 2 "1 J 2"1 J 2"1 J 2"4#### % % % 3 2 J 2b2 J 2b= J 2bE 3I 1001110

or$ NP 3 E4 J 14 14 3 P J E E34J2 NP 3 E4 J P J 4 J 2 3 2bE J 2b= J 2b2 J2b1 3I1001110% 14 May 2012 Day 9 Mono.a pha)etic Ciphers Po y.a pha)etic Ciphers . . 90 7C < 1900 /D 1N00-s < 1Q00-s

Te egraph starte& coming into the picture in the 1PP0-s @a&ios starte& up aroun& the ear y 1Q00-s The pro) em (ith these (as that since they (ere )eing use& to re ay messages anyone cou & intercept the messages as the air(aves (eren-t secure% / so machines (hich e& to computers contri)ute& to their &o(nfa % Major changes cause& )y techno ogy$ More pu) ic communication over insecure connections% 7rute force attac*s are more possi) e "&ue to machines#% More peop e nee& secure communication "not just the mi itary#% Cryptography has no( move& in t(o &ifferent &irections$ lo!" #ip$ers% 6arge amounts of te!t )eing encrypte& together% Computer )ase&G uses )inary5 su)stitution5 transposition5 an& permutations% 1!amp e$ M 0 1 2b! mo& 11$ 2 = P 4 9 9 10 E Q N N P = Q E 10 1 &'(li! )ey #rypto*rap$y% 1ncryption *ey is &ifferent from &ecryption *ey% 2no(ing encryption *ey an& ho( to encrypt &oes not revea the &ecryption *ey%

2b! mo& 1 2 4 11 Pic*$ ! )et(een 0 an& 10%

Pic*$ y )et(een 0 an& 10

! 3 =% i 3 2b! mo& 11 i 3 P% 'en& i over F * 3 jb! mo& 11% * 3 =b= mo& 11 * 3 9% 1!amp e$ =b! mo& PQ$ A% ! )et(een 0 an& PQ% ?e- choose ! 3 42% =b42 mo& PQ i 3 NQ% * 3 P9b42 mo& PQ * 3 =Q%

y 3 P% j 3 2by mo& 11 j 3 = mo& 11% 'en& j over k * 3 iby mo& 11% * 3 PbP mo& 11% * 3 9%

% y )et(een 0 an& PQ% ?e- choose y 3 NE% =bNE mo& PQ j 3 P9% * 3 NQbNE mo& PQ * 3 =Q%

The =b! mo& PQ is )roa&caste& pu) ic y an& so is (hat the i an& the j is% 1verything e se is &one private y% ?hy Does it ?or*Z";sing Previous 1!amp e#$ A% i 3 =b! mo& PQ i gets sent over F jb! mo& PQ "=by#b! mo& PQ =by! mo& PQ "Properties of e!ponents%# ?hy is it 'ecureZ$ =b! O NQ mo& PQ =by O P9 mo& PQ These are the on y *no(ns% Might )e mu tip e i-s% 2no(n as the &iscrete og pro) em% 8ave to try a possi) e !-s mo& PQ an& that-s the )est (ay to so ve it% 2 3 P9b! mo& PQ 2 3 NQby mo& PQ Diffie.8e man 2ey 1!change$ % j 3 =by mo& PQ j gets set over k iby mo& PQ "=b!#by mo& PQ =b!y mo& PQ

Came a)out in 1QNE F it (as the first e!amp e of pu) ic *ey cryptography% 4or Diffie.8e man 2ey 1!change (e nee& a goo& mo& n an& a goo& )ase5 )% Nee& )b! mo& n to ta*e on a va ues from 1 to n.1% Goo& mo&s are prime num)ers% Definition$ / num)er5 a5 is a generator mo& n if ab! mo& n cyc es through a num)ers 1 to n.1 mo& n% "Generator < Primitive @oot#% Pic* a arge prime5 p5 "hun&re&s of &igits ongs# an& (e nee& a generator mo& p for a )ase )% /$ Pic* a secret ! an& compute i 3 )b! mo& p 'en& i to 7 F 2 3 jb! mo& p% mo& p p 3 =9P1 ) 3 2% Pu) ic$ 'ecret$ 2b! mo& =9P1 /$ 111 2b111 mo& =9P1 i 3 902% =NEb111 mo& =9P1 2 3 E=Q% 15 May 2012 Day 10 [s it just a coinci&ence that pro) em 1E (or*e&Z 8ere (e are e!p oring other e!amp es% 1!amp e$ y 3 !b9 mo& E9 V 3 yb2Q mo& E9 7$ 24N 2b24N mo& =9P1 j 3 =NE% 902b24N mo& =9P1 7$ Pic* a secret y an& compute j 3 yb! mo& p 'en& j to / k 2 3 ib! mo& p% >n Map e$ (ith "numtheory#G or&er ")5 p#$ gives num)er of &ifferent num)ers in the set%

Diffie.8e man 2ey 1!change$ Protoco $

1!amp e$

Pu) ic$ 'ecret$

?e choose ! 3 19% 19b2Q mo& E9 3 49 49b2Q mo& E9 3 19

"!b9#b2Q 3 ! mo& E9 F !b149 3 ! mo& E9%

1!amp e$

y 3 !b= mo& 1N

V 3 yb11 mo& 1N

This time (e a so choose ! 319% 19b= mo& 1N 3 Q Qb11 mo& 1N 3 19

!b== 3 ! mo& 1N% /fter &oing /ctivity < 12 it is apparent that there is a pattern to (hat can ma*e some5 a5 !ba 3 ! mo& p% Conjectures$ C"p5 *# mo& p 3R 1 0 * 3 05 * 3 p 1 X * X p < 1S%

[f p is prime "! J y#bp mo& p 3 !bp J ybp% [D1/$ C"N5 =# 3 NC D "=C4C# mo& N 3 N T "EC D "=C4C## 3 N "ET9 D =T2# 3 N"9# ] ] Must )e an integer% [ntegerC C"E5 4# 3 EC D "2C4C# 3 ET9 D 2 3 E "9D2# ] Not an [nteger% Theorem1$ C"p5 *# mo& p 3R 1 0 * 3 05 * 3 p 1 X * X p < 1S%

Proof$ 6et * 3 0% C"p5 0# 3 pC D "pC0C# 3 1% 6et * 3 p% C"p5 p# 3 pC D "0CpC# 3 1% 6et 1 X * X p < 1% C"p5 *# 3 pC D "*C"p < *#C# (here 1 X * X p < 1 1Xp<*Xp<1 ?e *no( C"p5 *# is a (ays an integer since there are an integer num)er of (ays to pic* * o)jects from a set of p o)jects% Thus5 *C"p < *#C ^ pC% No(5 p is prime an& *C an& "p < *#C &o not have a factor of p since 1 X * X p < 1G 1 X p < * X p < 1G an& p is prime%

Thus5 *C "p < *#C must &ivi&e "p < 1#C since it has no factors in common (ith p% 'o5 C"p5 *# 3 pC D "*C"p < *#C# 3 p " "p < 1#C D "*C"p < *#C## (here "p < 1#C D "*C"p < *#C# is an integer% Therefore5 C"p5 *# 3 0 mo& p% Theorem2$ "! J y#bp mo& p 3 !bp J ybp (here p is prime% "/2/ The ?ishfu Thin*ing Theorem#

Proof$ 7y the 7inomia Theorem of 1!pansion$ "! J y#bp 3 C"p5 0#T!bp J C"p5 1#T!b"p < 1# y J H JC"p5 p#Tybp 7y Theorem 1$ "! J y#bp 3 1T!bp J 0 J 0 J H J 1Tybp 3 !bp J ybp mo& p% [D1/$ Proof )y [n&uction 'tart off (ith a )ase case sho( a statement is true for one n "often &one for n 3 1#% Then (e sho( if the statement is true for n 3 *5 then the statement is true for n 3 * J 1% 'o5 sho( n 3 1 'ho( if n 3 *5 then n 3 * J 1 Conc u&e statement is true for a n a 1% Theorem$ 4or a integers n a 1$ 1 J 2 J H J n 3 "n "nJ1## D 2%

Proof$ ;sing in&uction5 for a )ase case5 n 3 1 68' 3 1 @8' 3 "1"1 J 1## D 2 3 1% 131% 4or in&uctive step5 assume true for some n 3 *% 1 J 2 J H J * 3 "*"* J1## D 2 /&& * J1 to )oth si&es% 1 J 2 J H J * J "*J1# 3 "*"* J 1## D 2 J "* J 1# 3 "*"* J1# J 2"* J 1## D 2 3 "* J 1#"* J 2# D 2% Thus5 1 J 2 J H J n 3 "n"n J 1## D 2 is true for a n a 1%

Theorem$

4ermat-s 6itt e Theorem [f p is a prime then5 !bp 3 ! mo& p% Moreover5 if gc& "!5 p# 3 15 then !b"p < 1# 3 1 mo& p%

Proof$ [n&uction on !% 7ase case$ ! 3 1% 68'$ 1bp 3 1 mo& p @8'$ 1 3 1 mo& pD /ssume5 *bp 3 * mo& p% 'ho( "* J 1#bp 3 "* J 1# mo& p% "* J 1#bp 3 *bp J 1bp mo& p )y our (ishfu thin*ing theorem 7y assumption *bp 3 * mo& p 7y )ase case 1bp 3 1 mo& p Thus "* J 1#bp 3 *bp J 1bp 3 * J 1 mo& p 7y [n&uction !bp 3 ! mo& p for a ! a 1% 17 May 2012 Day 11 Theorem$ 1!amp e$ [f p & 0 are &istinct primes5 then _"p0# 3 _"p#T_"0#

_"=TN# 3 _"21# Cross out a mu tip es of ="ye o(# an& a mu tip es of N") ue%# 1 P 2 Q = 10 4 11 9 12 E 1= N 14

19 1E 1N 1P 1Q 20 21 _"21# 3 21 < 1D="21# < 1DN"21# J 1 3 21 < N < = J1 3 12 12 3 2 T E 3 _"=# _"N# Proof$ To count the num)ers of num)ers from 1 to p0 that are re ative y prime to p05 (e start (ith a a p0 num)ers an& su)tract off the ones that &o have a factor in common (ith p0% 'ince p an& 0 are &istincts5 the on y factors a num)er cou & have in common (ith p0 are p or 0%

The num)ers that have a factor of p are$ 15 p5 2p5 =p5 H5 0p so there are 0 of them% The num)ers that have a factor of 0 are$ 15 05 205 =05 H5 p0 so there are p of them% 8o(ever5 any num)er (hich is a mu tip e of )oth p an& 0 is &ou) e counte&% These num)ers (ou & a )e mu tip es of cm "p5 0# 3 p0% Thus5 on y p0 is &ou) e&% 'o the num)er of R15 25 =5 H5 p0S that are re ative prime are$ p0 < 0 < p J 1 _"p0# 3 p0 < 0 < p J 1 3 0"p < 1# < 1"p < 1# 3 "0 < 1#"p < 1# 3 _"0# _"p#% 1u er-s Theorem$ 6emma$ 1!amp e$ [f gc& "a5 n# 3 1 then5 ab _"n# 3 1 mo& n% [f p an& 0 are &istinct primes an& ! 3 y mo& p an& ! 3 y mo& 0 then ! 3 y mo& p0%

p 3 =5 0 3 N 4 3 1 mo& =5 )ut 4 ` 1 mo& N% Doesn-t (or* for this case5 )ut 22 3 1 mo& =% 22 1 mo& N% 3I 22 1 mo& 21% ! 3 y mo& = M 3y mo& N ! < y 3 =* ! < y 3 Nl =* 3 Nl 3I means = &ivi&es Nl5 )ut since = &oes not &ivi&e N5 then =^l% Nl 3 NT=m 3 21 m% ! < y 3 21m F ! 3 y mo& 21% Proof$ /ssume ! 3 y mo& p an& ! 3 y mo& 0 )y &efinition = of Mo&u ar /rithmetic$ ! < y 3 p* for some * ! < y 3 0l for some * % 'o5 ! < y 3 p* 3 0l Thus5 p ^ 0l. 7ut p an& 0 are &istinct primes so p an& 0 have no factors in common% +gc&"p5 0# 3 1, Therefore p must &ivi&e l% 'o 0l 3 0 Tpm 3 p0Tm 7y &efinition = of Mo&u ar /rithmetic$ ! 3 y mo& p0%

1u er-s$

"[f n 3 p0# if gc& "a5 p0# 3 1 then ab_"p0# 3 1 mo& p0%

Proof$ _"p0# 3 "p < 1#"0 < 1# from previous theorem% ab"p < 1# 3 1 mo& p from 4lt ab"0 < 1# 3 1 mo& 0 from 4lt @aise )oth si&es of )oth pro) ems to 0 < 1% "ab"p < 1##b"0 < 1# 3 1b"0 < 1# mo& p "ab"0 < 1##b"p < 1# 3 1b"p < 1# mo& 0 ab""p < 1#"0 < 1## 3 1 mo& p ab""0 < 1#"p < 1## 3 1 mo& 0 ab_"p0# 3 1 mo& p ab_"p0# 3 1 mo& 0 7y emma5 ab_"p0# 3 1 mo& p0% 18 May 2012 Day 12 Theorem$ !b"1 J _"p0#*# 3 "! mo& p0# for a !%

Proof$ 6et gc&"!5 p0# 3 1% 3 !b"_"p0#* J 1# mo& p0 3 !T!b"_"p0#*# mo& p0 3 !"!b"_"p0##b* mo& p0 3 !T1b* mo& p0 3 ! mo& p0% 6et gc&"!5 p0# 3 p0% 'ince gc&"!5 p0# 3 p0 then5 ! 3 tTp0 for some t % This means ! mo& p0 3 0 'o5 !b"_"p0#* J1# mo& p0 3 o 0 3 0 mo& p0 Thus5 !b"_"p0#* J1# 3 ! mo& p0% 6et gc&"!5 p0# 3 p ?e (i consi&er this eva uation mo& p an& mo& 0% 4irst case$ since gc&"!5 p0# 3 p then p^! an& thus ! 3 tTp for some t % ! 3 0 mo& p !b"_"p0#* J1# 3 0b"_"p0#* J1# 3 0 mo& p Thus5 !b"_"p0#* J1# 3 ! mo& p% 'econ& case$ since gc& "!5 p0# 3 p then5 gc&"!5 0# 3 1% 'o (e can app y 4lT5 !b"0 < 1# 3 1 mo& 0% !b"_"p0#* J1# 3 !b"_"p0#*# T ! 3 !b"_"p#_"0#*# T !

)y 1u er-s Theorem

3 "!b_"0##b"_"p#*# T ! 3 1b"_"p#*# T ! 3 ! mo& 0 !b"_"p0#* J1# 3 ! mo& p0 6et gc&"!5 p0# 3 0

)y 4lT )y 6emma

?e (i consi&er this eva uation mo& p an& mo& 0% 4irst case$ since gc&"!5 p0# 3 0 then 0^! an& thus ! 3 tT0 for some t % ! 3 0 mo& 0 !b"_"p0#* J1# 3 0b"_"p0#* J1# 3 0 mo& 0 Thus5 !b"_"p0#* J1# 3 ! mo& 0% 'econ& case$ since gc& "!5 p0# 3 0 then5 gc&"!5 p# 3 1% 'o (e can app y 4lT5 !b"p < 1# 3 1 mo& p% !b"_"p0#* J1# 3 !b"_"p0#*# T ! 3 !b"_"p#_"0#*# T ! 3 "!b_"p##b"_"0#*# T ! 3 1b"_"0#*# T ! )y 4lT 3 ! mo& p !b"_"p0#* J1# 3 ! mo& p0 @'/ Protoco $ @'/ < @ivest5 'hamir5 /& eman% Pu) ishe& in 1QNP "D8 < 1QNE# Message is converte& to a numerica )ase% Pic* p an& 0 to )e arge primes "=00J &igits each%# p an& 0 are *ept secret% Compute _"p0# 3 "p < 1#"0 < 1# an& a so *eep a secret% pic* e5 such that gc&"e5 _"p0## 3 1% e (i )e pu) ic% Compute & (here e& 3 1 mo& _"p0# 1ncryption 4ormu a$ CT 3 PTbe mo& p0% Decryption 4ormu a$ PT 3 CTb& mo& p0% ?hy &oes it (or*Z 1u er-s Theorem% "!be#b& 3 !be& e& 3 1 mo& _"p0# )y 6emma

e& 3 1 J _"p0#* !be& 3 !b"1 J _"p0#*# 3 ! T "!b"_"p0##* 3 ! mo& n% ?hy is it secureZ 1!amp e$ ?hy is our num)er tric* mo& p not secureZ y 3 !be mo& p ! 3 yb& mo& p pu) ic$ e5 p private$ p < 15 &

No easyDfast (ay to factor a E00J &igit num)er 'ince factoring is har& an& computing _"n# is on y fast if (e factor n "counting a non.re ative primes num)ers is a so rea y &amn s o(% 4or ?e)sites$ @'/ is often use& to e!change a *ey an& then message is encrypte& (ith a ) oc* cypher% " Trip e D1'5 Data 1ncryption 'tan&ar&5 or /1'5 /&vance& 1ncryption 'tan&ar&%# Digita 'ignatures$ 1ntity / (i have a pu) ic encryption an& a secret &% 1!$ Mb9 mo& Q1 (ou & )e the pu) ic encryption metho& & 3 2Q% This (ou & )e secret% / if (anting to sen& a message (ou & encrypt it (ith the pu) ic *ey5 )ut since it-s pu) ic it must )e accompanie& )y a signature5 l5 (hich has to )e encrypte& (ith the secret *ey% l 3 mb2Q mo& Q1 'o5 "M5 l# is sent over5 )ut )efore )eing fu y sent over (e have to use the )an*-s pu) ic encryption co&e$ Mb11 mo& 11Q% Their secret *ey is & 3 =9% 'o5 "CTM5 Ctl# is sent over% The )an*5 once having receive& the crypt message sent over pu) ic air(aves5 (ou & then &ecrypt the entire thing (ith their secret co&e5 get the message5 then using /-s pu) ic co&e (ou & chec* an& verify if the signature is (hat it-s suppose& to )e% 21 May 2012 Day 13 7 oc* Ciphers 1ncrypts etters in groups% P ayfair Cipher Dates )ac* to the 1P00-s an& uses ) oc*s of t(o etters% ;ses a *ey(or& an& p aces etters into to a 9!9 )o!% This ea&s to a sma pro) emG there are 2E etters in the 1ng ish anguage% This is reme&ie& )y omitting a etter that is har& y use&% ;sua y the etter &roppe& is j an& if it-s necessary in the message then it-s su)stitute& as an -i-%

1ncryption$ ;sing the *ey(or& -P6/K4/[@- (e can ma*e our o(n *ey% ?e can-t repeat etters though so instea& (e use -P6/K4[@-% P 6 / K 4 [ @ 7 C D T 1 G 8 2 M N > \ ' ; B ? M A [f (e have our p ain te!t$ U>;@ M/K T1@M ?[66 71 D>N1 '>>NW% ?e ta*e it an& separate it into 2 etter ) oc*s ma*ing sure not to have repeats in the same ) oc*5 if (e &o (e stic* a fi er etter an& *eep going (ith separating into ) oc*s% [f there is an e!tra etter eft then again (e use a fi er etter% our PT )ecomes$ U >; @M /K T1 @M ?[ 6M 67 1D >N 1' >M >N%W [n this case our fi er (as -M-% [t-s &ifficu t to e!p ain ho( to encrypt (ithout using images an& ots an& ots of pointing an& &ra(ing so instea& [- (rite it out an& it can easi y )e figure& out from there% PT: O% RM A& TE RM "I LX LB ED ON ES OX ON CT: NV DG &F NM DG %V &V AR MI 'O KN SV 'O Note that at times (hen the etters in the ) oc* are in the same ro( or co umn (e instea& move to the ne!t etter over or &o(n5 respective y% Decryption$ Done in e!act y the same manner e!cept that for etters that are in the same ro( or co umn (e instea& move one to the eft or one up5 respective y% 8i Cipher Done using n!n matrices that act on ) oc*s of siVe n% ?e (i use 2!2 matrices on ) oc*s of 2% >; @M /K T1%%% +145 20, +1N5 12, +05 24, +1Q5 4,%%% 1ncryption (CT1) * (A (CT2) * (C B) (PT1) D) (PT2) +,- 26

Decryption To so ve for p ain te!t5 so (e can &ecrypt5 (e nee& to invert the matri! mo& 2E% (. (1 /)01 01 (- 0/) -) * 2.- 3 /14 (01 .) +,- 26

That is5 on y if gc&"&5 2E# 3 1% [f the gc&"&5 2E# is not 1 then the cipher can-t )e un&one correct y% [ other (or&s5 (hen encrypting one must ta*e into account this in or&er to ma*e a goo& cipher% Then (e ta*e that matri!5 mu tip y it times +CT15 CT2, an& (e get +PT15 PT2,% 1ncryption is straightfor(ar& so there-s no point in sho(ing an e!amp e (ith the genera e0uation )eing (ritten a)ove% 1!amp e of &ecryption$ L56 M * (3 (4 1) 5) +,- 26

- * 2375 3 4714 * 15 3 4 * 11 PT * 01 (5 01) (04 3) +,- 26

01 (5 01) * 11 (04 3) +,- 26 * 1# (5 01) (04 3) +,- 26 8) 5)

(#5 01#) (18 * (086 58) +,- 26 * (2

?e use this to &ecrypt our CT an& so5 for this e!amp e$ (PT1) (18 (PT2) * (2 8)7(CT1) 5) (CT2) +,- 269

You might also like