{VERSION 5 0 "IBM INTEL NT" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 1 12 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Geneva" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 2" -1 4 1 {CSTYLE "" -1 -1 "Geneva" 1 14 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 2 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 3" -1 5 1 {CSTYLE "" -1 -1 "Ge neva" 1 12 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 } {PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 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 12 1 {CSTYLE "" -1 -1 "" 0 1 0 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 "Title" -1 18 1 {CSTYLE "" -1 -1 "Geneva" 1 18 0 0 0 1 2 1 1 2 2 2 1 1 1 1 }3 1 0 0 12 12 1 0 1 0 2 2 19 1 } {PSTYLE "Author" -1 19 1 {CSTYLE "" -1 -1 "Geneva" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 8 8 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 18 "" 0 "" {TEXT -1 25 "Conversions of Data Types " }}{PARA 19 "" 0 "" {TEXT -1 35 "\251Mike May, S.J. 2002, maymk@slu.e du" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 657 "This worksheet is focused on the prelimi nary work of conversion of data formats. As we work with encryption, \+ we will want to put messages in a number of different formats. We fir st want to convert back and forth between normal text and strings of n umbers. For reasons that will become apparent later we will also want to be able to convert the numbers between decimal, binary, and hexade cimal formats. To make ciphertext manageable we want to be able to co ncatenate the hex numbers into blocks. Finally, since some codes use \+ finite field arithmetic, we want to be able to convert binary strings \+ to polynomials in alpha over Z2 and then to convert back." }}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 18 "Entering a message" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 104 "To be able to look at specific examples, we start b y creating a standard message that we will work with." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 143 "message1 :=\"AZaz Good morning Mr. Phelps. Your mission for today, \nshould you choose to accept it, is to encode this message. AZaz\";\nmessage1;" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%)message1GQbrAZaz~Good~morning~Mr.~Phelps.~~Your~miss ion~for~today,~|+should~you~choose~to~accept~it,~is~to~encode~this~mes sage.~AZaz6\"" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#QbrAZaz~Good~morning~ Mr.~Phelps.~~Your~mission~for~today,~|+should~you~choose~to~accept~it, ~is~to~encode~this~message.~AZaz6\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 171 "(Notice that strings handle carriage returns as the special ch aracter \"\\n\". If we want to include the \" symbol we use either a \+ backslash quote \\\", or a double quote ''.) " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 105 "The plain text starts and ends with the string AZaz t o give easy clues for understanding the conversions." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 49 "Conversions 1 - Letters to numbers and back again" }}{EXCHG {PARA 0 " " 0 "" {TEXT -1 205 "For most of the encryption systems we will study \+ this semester, we have to look at a preliminary task of converting the messages into some kind of numerical equivalent that we can apply our equations to. " }}{PARA 0 "" 0 "" {TEXT -1 472 "With the classical c iphers we have looked at we considered a simple conversion that let a \+ be represented by the number 0, b by the number 1, and so on down to z . This is easy to do by hand once we make a conversion table. Unfort unately, that system has the drawback of not dealing with capitol and \+ small letters or spaces and other special characters. Instead we will used a conversion to ASCII. ASCII is the standard conversion used fo r most current computer systems." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 142 "With Maple, we convert between alphanumeric strings and strings o f integers with the convert command. The syntax is\n convert(xxx, bytes);" }}{PARA 0 "" 0 "" {TEXT -1 33 "The same command works both w ays." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "temp[1] := convert( message1, bytes);\ntemp[2] := convert(temp[1], bytes);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>&%%tempG6#\"\"\"7cr\"#l\"#!*\"#(*\"$A\"\"#K\"#r\" $6\"F/\"$+\"F-\"$4\"F/\"$9\"\"$5\"\"$0\"F3\"$.\"F-\"#xF2\"#YF-\"#!)\"$ /\"\"$,\"\"$3\"\"$7\"\"$:\"F7F-F-\"#*)F/\"$<\"F2F-F1F4F=F=F4F/F3F-\"$- \"F/F2F-\"$;\"F/F0F+\"$@\"\"#WF-\"#5F=F9F/F?F;F0F-FBF/F?F-\"#**F9F/F/F =F:F-FAF/F-F+FEFEF:F&%%tempG 6#\"\"#QbrAZaz~Good~morning~Mr.~Phelps.~~Your~mission~for~today,~|+sho uld~you~choose~to~accept~it,~is~to~encode~this~message.~AZaz6\"" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 202 "(Maple will convert from either a name (enclosed in back quotes `) or a string (enclosed in double quot es \"), but it returns a string. You must explicitly convert to type \+ name if that is what we want.)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 185 "We can see that the A SCII conversion takes A to 65, Z to 90, a to 97, z to 122, and a blank space to 32. The letters between a and z are converted in order so t hat B is 66 and b is 98." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 61 "The convert command can also be used on an array o f integers." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 95 "convert([65, 255, 66, 256, 67, 257, 68], bytes);\nconvert([65,2,66, 1, 67, 0, 68, - 2, 69],bytes);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q$A|jzB6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q&A|#B|\"C6\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "A few things to notice:" }}{PARA 0 "" 0 "" {TEXT -1 223 " 1) The convert function from integer to ASCII assumes the input is be tween 1 and 255, inclusive. If fed an integer outside that range, the conversion routine stops. In that case, it does not process the rest of the list." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 178 "2) We only need 52 of the 255 places for English letter s counting upper and lower case. That leaves enough room for all the \+ special characters and a lot of extra space as well." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 0 {PARA 5 "" 0 "" {TEXT -1 9 "E xercises" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 136 "1) Produce a convers ion chart for converting the lower case letters in the set \{a, c, e, \+ g, h, i, m, r, s, t\} to the ASCII equivalent." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 83 "2) Pr oduce a conversion chart for converting the special characters in the \+ string " }}{PARA 0 "" 0 "" {TEXT -1 50 "`,.;' :\"[]\{\}()!$%?` used fo r punctuation to ASCII." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 108 "3) Use your table to conver t the string \"this is a secret message\" to ASCII. Use Maple to chec k your work." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 177 "4) Type the first full paragraph on pag e 1 of your book and save it as message2. Use Maple to convert messag e2 to the string of numbers corresponding to the ASCII equivalents." } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 0 {PARA 5 "" 0 "" {TEXT -1 47 "Warning - A bug in the Maple conversion routine" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 266 "There is a bug in the Maple conve rsion routine that you should be aware of. It does not affect the cha racters we normally use in typing, but it is worth noting anyway. The bug is that Maple converts both 10 and 13 to carriage return, which i s converted back to 13." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 112 "numstring := [seq(i,i=5..15)];\ncharstring := convert(numstring,bytes );\nnumstring2 := convert(charstring, bytes);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%*numstringG7-\"\"&\"\"'\"\"(\"\")\"\"*\"#5\"#6\"#7\"# 8\"#9\"#:" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%+charstringGQ,|&|'|(|)| *|+|,|-|.|/|06\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%+numstring2G7-\" \"&\"\"'\"\"(\"\")\"\"*\"#5\"#6\"#7\"#8\"#9\"#:" }}}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 64 "Conversions 2 - Other number systems (hexadecimal in particular)" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 444 "For most math \+ classes we do arithmetic in base 10. The base was chosen by an accide nt of history. (Look at your hands and identify the accident.) When \+ we deal with digital computers we often do binary arithmetic do to an \+ accident of mechanics. (The accident is that transistors have two stat es, on and off.) One of the disadvantages of binary is that the numbe rs quickly become too long. That has led to the use of base 16, or he xadecimal." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 60 "The syntax used to convert a decimal number xxx to binary is" } }{PARA 0 "" 0 "" {TEXT -1 26 " convert(xxx, binary);" }}{PARA 0 " " 0 "" {TEXT -1 49 "The command to convert to hexadecimal is similar, " }}{PARA 0 "" 0 "" {TEXT -1 23 " convert(xxx, hex);" }}{PARA 0 " " 0 "" {TEXT -1 233 "There is a catch with these two commands. We wan t to use them on an array of decimal numbers. To do this we use the m ap command. The commands to convert an array, XXX, of decimal numbers to binary and hexadecimal are respectively:" }}{PARA 0 "" 0 "" {TEXT -1 31 " map(convert, XXX, binary);" }}{PARA 0 "" 0 "" {TEXT -1 28 " map(convert, XXX, hex);" }}{PARA 0 "" 0 "" {TEXT -1 42 "The comm ands to reverse the processes are:" }}{PARA 0 "" 0 "" {TEXT -1 41 " \+ map(convert, XXX, decimal, binary);" }}{PARA 0 "" 0 "" {TEXT -1 37 " map(convert, XXX, decimal, hex);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 229 "temp[3] := map(convert, temp[1], binary);\ntemp[4] : = map(convert, temp[1], hex);\ntemp[5] := map(convert, temp[3], decima l, binary);\nconvert(temp[5], bytes);\ntemp[6] := map(convert, temp[4] , decimal, hex);\nconvert(temp[6], bytes);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>&%%tempG6#\"\"$7cr\"(,++\"\"(55,\"\"(,+5\"\"(556\"\"'+ +5\"(6,+\"\"(665\"F/\"(+,5\"F-\"(,65\"F/\"(5+6\"\"(565\"\"(,55\"F3\"(6 ,5\"F-\"(,6+\"F2\"'565F-\"(++,\"\"(+55\"\"(,,5\"\"(+65\"\"(++6\"\"(6+6 \"F7F-F-\"(,5,\"F/\"(,,6\"F2F-F1F4F=F=F4F/F3F-\"(5,5\"F/F2F-\"(+,6\"F/ F0F+\"(,56\"\"'+65F-\"%55F=F9F/F?F;F0F-FBF/F?F-\"(6+5\"F9F/F/F=F:F-FAF /F-F+FEFEF:F&%%tempG6#\"\"%7 cr%#41G%#5AG%#61G%#7AG%#20G%#47G%#6FGF/%#64GF-%#6DGF/%#72G%#6EG%#69GF3 %#67GF-%#4DGF2%#2EGF-%#50G%#68G%#65G%#6CG%#70G%#73GF7F-F-%#59GF/%#75GF 2F-F1F4F=F=F4F/F3F-%#66GF/F2F-%#74GF/F0F+%#79G%#2CGF-%\"AGF=F9F/F?F;F0 F-FBF/F?F-%#63GF9F/F/F=F:F-FAF/F-F+FEFEF:F&%%tempG6#\"\"&7cr\"#l\"#!*\"#(*\"$A\"\"#K\"#r\"$6\"F/ \"$+\"F-\"$4\"F/\"$9\"\"$5\"\"$0\"F3\"$.\"F-\"#xF2\"#YF-\"#!)\"$/\"\"$ ,\"\"$3\"\"$7\"\"$:\"F7F-F-\"#*)F/\"$<\"F2F-F1F4F=F=F4F/F3F-\"$-\"F/F2 F-\"$;\"F/F0F+\"$@\"\"#WF-\"#5F=F9F/F?F;F0F-FBF/F?F-\"#**F9F/F/F=F:F-F AF/F-F+FEFEF:F&%%tempG6#\"\"'7cr\"#l\"#!*\"#(*\"$A\"\"#K\"#r\"$6\"F/ \"$+\"F-\"$4\"F/\"$9\"\"$5\"\"$0\"F3\"$.\"F-\"#xF2\"#YF-\"#!)\"$/\"\"$ ,\"\"$3\"\"$7\"\"$:\"F7F-F-\"#*)F/\"$<\"F2F-F1F4F=F=F4F/F3F-\"$-\"F/F2 F-\"$;\"F/F0F+\"$@\"\"#WF-\"#5F=F9F/F?F;F0F-FBF/F?F-\"#**F9F/F/F=F:F-F AF/F-F+FEFEF:F " 0 "" {MPLTEXT 1 0 94 "twodigithex := \+ a -> substring(convert(256+a,hex),2..3):\ntemp[a4] := map(twodigithex, temp[1]);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>&%%tempG6#%#a4G7cr%#41G %#5AG%#61G%#7AG%#20G%#47G%#6FGF/%#64GF-%#6DGF/%#72G%#6EG%#69GF3%#67GF- %#4DGF2%#2EGF-%#50G%#68G%#65G%#6CG%#70G%#73GF7F-F-%#59GF/%#75GF2F-F1F4 F=F=F4F/F3F-%#66GF/F2F-%#74GF/F0F+%#79G%#2CGF-%#0AGF=F9F/F?F;F0F-FBF/F ?F-%#63GF9F/F/F=F:F-FAF/F-F+FEFEF:F " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "6) Convert message2 to an array of two character he xadecimal numbers." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} }{SECT 0 {PARA 4 "" 0 "" {TEXT -1 30 "Arranging letters into \"words\" " }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 546 "Using strings of numbers does give an easy first encryption. (It is not very secure however.) On e of the problems with strings of numbers is that they are cumbersome \+ to write. The conversion of every ASCII character to a two character \+ hex string lets us concatenate hex characters into words of uniform le ngth. We now define procedures for turning a vector of hexadecimal nu mbers into an array of blocks, with bsize numbers put into each block, and the last block padded out with zeroes. We also define a procedur e for undoing the blocking." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 374 "blocker := proc(hexvec,bsize)\nlocal numCharacters, paddingNum, n umWords, i, j, temp, hexblock;\ntemp := hexvec;\nnumCharacters :=linal g[vectdim](hexvec);\nnumWords := ceil(numCharacters/bsize);\npaddingNu m := numWords*bsize - numCharacters;\ntemp := [op(temp),seq(`00`,j = 1 ..paddingNum)];\nhexblock := \n [seq( cat(seq(temp[bsize*i + j], j \+ = 1..bsize)), i=0..numWords-1)]:\nend:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 128 "numCharacters :=linalg[vectdim](temp[a4]);\nbl4 := b locker(temp[a4],4);\nbl7 := blocker(temp[a4],7);\nbl11 := blocker(temp [a4],11);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%.numCharactersG\"$>\"" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%$bl4G7@%)415A617AG%)20476F6FG%)642 06D6FG%)726E696EG%)67204D72G%)2E205068G%)656C7073G%)2E202059G%)6F75722 0G%)6D697373G%)696F6E20G%)666F7220G%)746F6461G%)792C200AG%)73686F75G%) 6C642079G%)6F752063G%)686F6F73G%)6520746FG%)20616363G%)65707420G%)6974 2C20G%)69732074G%)6F20656EG%)636F6465G%)20746869G%)73206D65G%)73736167 G%)652E2041G%)5A617A00G" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%$bl7G73%/ 415A617A20476FG%/6F64206D6F726EG%/696E67204D722EG%/205068656C7073G%/2E 2020596F7572G%/206D697373696FG%/6E20666F722074G%/6F6461792C200AG%/7368 6F756C6420G%/796F752063686FG%/6F736520746F20G%/61636365707420G%/69742C 20697320G%/746F20656E636FG%/64652074686973G%/206D6573736167G%/652E2041 5A617AG" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%%bl11G7-%7415A617A20476F6 F64206DG%76F726E696E67204D722E20G%75068656C70732E2020596FG%77572206D69 7373696F6E20G%7666F7220746F6461792C20G%70A73686F756C6420796F75G%720636 86F6F736520746F20G%76163636570742069742C20G%7697320746F20656E636F64G%7 652074686973206D657373G%76167652E20415A617A0000G" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 172 "Notice that blocks of size 4 require 1 more chara cter, while blocks of size 7 come out even, and blocks of size 11 need 2 extra characters to make the blocks come out even." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 121 "unblocker := (hexblock,bsize) ->\n map(hexString -> seq(substring(hexString,2*j-1..2*j), j = 1..bsize) ,\n hexblock):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 77 "s4 : = unblocker(bl4, 4);\ns7 := unblocker(bl7, 7);\ns11 := unblocker(bl11, 11);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%#s4G7dr%#41G%#5AG%#61G%#7AG %#20G%#47G%#6FGF,%#64GF*%#6DGF,%#72G%#6EG%#69GF0%#67GF*%#4DGF/%#2EGF*% #50G%#68G%#65G%#6CG%#70G%#73GF4F*F*%#59GF,%#75GF/F*F.F1F:F:F1F,F0F*%#6 6GF,F/F*%#74GF,F-F(%#79G%#2CGF*%#0AGF:F6F,FF,F*F(FBFBF7F9F>F*F1F>F@F*F1F:F*F>F,F*F7F0FBF,F-F7F*F>F6F1F:F*F .F7F:F:F(F2F7F4F*F&F'F(F)%#00G" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%#s 7G7cr%#41G%#5AG%#61G%#7AG%#20G%#47G%#6FGF,%#64GF*%#6DGF,%#72G%#6EG%#69 GF0%#67GF*%#4DGF/%#2EGF*%#50G%#68G%#65G%#6CG%#70G%#73GF4F*F*%#59GF,%#7 5GF/F*F.F1F:F:F1F,F0F*%#66GF,F/F*%#74GF,F-F(%#79G%#2CGF*%#0AGF:F6F,FF,F*F(FBFBF7F9F>F*F1F>F@F*F1F:F*F>F,F* F7F0FBF,F-F7F*F>F6F1F:F*F.F7F:F:F(F2F7F4F*F&F'F(F)" }}{PARA 12 "" 1 " " {XPPMATH 20 "6#>%$s11G7er%#41G%#5AG%#61G%#7AG%#20G%#47G%#6FGF,%#64GF *%#6DGF,%#72G%#6EG%#69GF0%#67GF*%#4DGF/%#2EGF*%#50G%#68G%#65G%#6CG%#70 G%#73GF4F*F*%#59GF,%#75GF/F*F.F1F:F:F1F,F0F*%#66GF,F/F*%#74GF,F-F(%#79 G%#2CGF*%#0AGF:F6F,FF,F*F(FBFBF7F9F> F*F1F>F@F*F1F:F*F>F,F*F7F0FBF,F-F7F*F>F6F1F:F*F.F7F:F:F(F2F7F4F*F&F'F( F)%#00GFC" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 81 "It is worthwhile to \+ convert from blocks all the way back to the original message." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "s7 := unblocker(bl7, 7);\nb7 := map(convert, s7, decimal, hex);\nconvert(b7, bytes);" }}{PARA 12 " " 1 "" {XPPMATH 20 "6#>%#s7G7cr%#41G%#5AG%#61G%#7AG%#20G%#47G%#6FGF,%# 64GF*%#6DGF,%#72G%#6EG%#69GF0%#67GF*%#4DGF/%#2EGF*%#50G%#68G%#65G%#6CG %#70G%#73GF4F*F*%#59GF,%#75GF/F*F.F1F:F:F1F,F0F*%#66GF,F/F*%#74GF,F-F( %#79G%#2CGF*%#0AGF:F6F,FF,F*F(FBFBF7 F9F>F*F1F>F@F*F1F:F*F>F,F*F7F0FBF,F-F7F*F>F6F1F:F*F.F7F:F:F(F2F7F4F*F& F'F(F)" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%#b7G7cr\"#l\"#!*\"#(*\"$A \"\"#K\"#r\"$6\"F,\"$+\"F*\"$4\"F,\"$9\"\"$5\"\"$0\"F0\"$.\"F*\"#xF/\" #YF*\"#!)\"$/\"\"$,\"\"$3\"\"$7\"\"$:\"F4F*F*\"#*)F,\"$<\"F/F*F.F1F:F: F1F,F0F*\"$-\"F,F/F*\"$;\"F,F-F(\"$@\"\"#WF*\"#5F:F6F,FF,F*F(FBFBF7F9F>F*F1F>F@F*F1F:F*F>F,F*F7F0FBF,F-F7F *F>F6F1F:F*F.F7F:F:F(F2F7F4F*F&F'F(F)" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#QbrAZaz~Good~morning~Mr.~Phelps.~~Your~mission~for~today,~|+should~ you~choose~to~accept~it,~is~to~encode~this~message.~AZaz6\"" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 64 "It should be noted that all four s teps can be done in one line. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "convert(map(convert, unblocker(bl7,7), decimal, hex), bytes); " }}{PARA 12 "" 1 "" {XPPMATH 20 "6#QbrAZaz~Good~morning~Mr.~Phelps.~~ Your~mission~for~today,~|+should~you~choose~to~accept~it,~is~to~encode ~this~message.~AZaz6\"" }}}{SECT 0 {PARA 5 "" 0 "" {TEXT -1 9 "Exercis es" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 141 "7) Convert message2 into h ex blocks with 5 characters going into each word. (The words in your \+ answer should appear to be 10 letters long.)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "8) Conv ert the message " }}{PARA 0 "" 0 "" {TEXT -1 154 "[`415A617A20`, `546 8652072`, `61696E2069`, `6E20537061`, `696E206661`, `6C6C73206D`, `616 96E6C79`, `20696E2074`, `686520706C`, `61696E2E20`, `415A617A00`]" }} {PARA 0 "" 0 "" {TEXT -1 34 "back to plaintext from hex blocks." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 49 "Conversio ns 3 - Binary numbers and finite fields." }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 451 "A number of commercial codes, including AES, include ste ps where binary numbers are viewed as numbers in finite fields and com bined with the arithmetic in the finite field. For this worksheet we \+ simply are concerned with the conversion routines. The conversion is \+ done by considering the digits of the binary number as the coefficient s on a polynomial in the variable alpha. The coefficients can be eith er 0 or 1 and are listed highest power first." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 290 "binPoly := proc(binNum)\n local binString, te mp, stringLen, i:\n binString := convert(binNum, string):\n temp : = 0:\n stringLen := length(binString):\n for i from 1 to stringLen do\n temp := temp + \n alpha^(stringLen-i)*parse(substrin g(binString,i)); od:\n sort(temp);\nend:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 32 "polya := binPoly(1000110001111);" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%&polyaG,0*$)%&alphaG\"#7\"\"\"F**$)F(\"\")F*F**$)F( \"\"(F*F**$)F(\"\"$F*F**$)F(\"\"#F*F*F(F*F*F*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 114 "To convert back, we simply evaluate the polynomial wi th alpha equaling 2, then convert to a binary representation." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "polyBin := poly -> convert(s ubs(alpha=2, poly), binary):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "polyBin(polya);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\".66+5,+\"" }}}{SECT 0 {PARA 5 "" 0 "" {TEXT -1 9 "Exercise;" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 125 "9) Convert the integers 120 -130 to their binary r epresentations and then into their representations as polynomials over Z2." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }