{VERSION 3 0 "IBM INTEL NT" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 } {CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 }{CSTYLE " " -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 271 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Norm al" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 11 256 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 257 "" 0 "" {TEXT -1 87 "Maple worksheet to perfo rm computations for RSA algorithm MME 529 6/15/99" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{XPPEDIT 18 0 "" "6#%#%?G" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{MPLTEXT 1 0 19 "p:=13;q:=17;n:=p*q;" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%\"pG\"#8" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"qG \"#<" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"nG\"$@#" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "k:=(p-1)*(q-1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"kG\"$#>" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 114 "no w I need a number which is not a divisor of k. To make life easy, I'll peek at its divisors and then avoid them." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 16 "with(numtheory):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "divisors(k);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<0\" \"\"\"\"#\"\"$\"\"%\"\"'\"\")\"#7\"#;\"#C\"#K\"#[\"#k\"#'*\"$#>" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "d:=65;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"dG\"#l" }}}{EXCHG {PARA 256 "" 1 "" {TEXT -1 99 "Ne xt, I need the multiplicative inverse of d, mod k; that is, the soluti on to 65x = 1(mod 192). I " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "ca n solve 65x + 192y=1 using the Maple function \"" }{TEXT 264 7 "isolve \"" }{TEXT -1 45 " instead of using Euclid's algorithm by hand!" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "isolve(d*x+k*y=1);" }{TEXT -1 51 "(in what follows, N1 is arbitrary. if we set it to " }{TEXT 266 3 "-1," }{TEXT -1 13 " we get that " }{TEXT 265 7 "e is 65" } {TEXT -1 72 " also - a chance event - a number being its own multiplic ative inverse!)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<$/%\"xG,&!$F\"\"\" \"%$_N1G!$#>/%\"yG,&\"#VF(F)\"#l" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 24 "the \"public key\" is now " }{TEXT 267 11 "e=65, n=221" }{TEXT -1 27 ". Let's encode the letter " }{TEXT 257 1 "B" }{TEXT -1 30 " which we'll give a value of " }{TEXT 256 2 "74" }{TEXT -1 4 " to:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "e:=65;B:=74;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"eG\"#l" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\" BG\"#u" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 15 "C:=(B^e)mod(n);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"CG\"$f\"" }}}{PARA 0 "" 0 "" {TEXT -1 7 "So the " }{TEXT 271 7 "encoded" }{TEXT -1 26 " version of the character " }{TEXT 268 2 "74" }{TEXT -1 4 " is " }{TEXT 269 3 "159" }{TEXT -1 57 ". To check \+ that things work alright, let's see if we can " }{TEXT 270 6 "decode" }{TEXT -1 8 " it back" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "(C^ d)mod(n);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"#u" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 78 "good! we got the same thing back. This does have i ts limitations - if you use " }{TEXT 262 5 "B > n" }{TEXT -1 55 ", you will only get a number back which is equal to B, " }{TEXT 263 5 "mod \+ n" }{TEXT -1 270 ", not the original B - try it! At this point, I have the machinery set up to code and decode numbers using the public key \+ of e=65 and n = 221. This is a terribly poor key because n is so smal l, but it does serve to illustrate the commands needed to do the calcu lations." }}}}{MARK "12" 0 }{VIEWOPTS 1 1 0 1 1 1803 }