<?xml version="1.0" encoding="UTF-8"?>
<Worksheet>
<Version major="12" minor="0"/>
<Label-Scheme value="2" prefix=""/>
<View-Properties presentation="false"></View-Properties>
<MapleNet-Properties elisiondigitsbefore="100" labelling="true" indentamount="4" elisiontermsthreshold="10000" ansi="false" errorbreak="1" useclientjvm="true" echo="1" imaginaryunit="I" labelwidth="20" plotdriver="openviz" elisiondigitsafter="100" plotoutput="terminal" rtablesize="10" elisiontermsbefore="100" elisiondigitsthreshold="10000" typesetting="standard" plotdevice="inline" verboseproc="1" showassumed="1" errorcursor="false" longdelim="true" plotoptions="" quiet="false" elisiontermsafter="100" screenwidth="79" preplot="" prettyprint="3" displayprecision="-1" warnlevel="3" screenheight="25" latexwidth="6.0" postplot="" prompt="&gt; " ShowLabels="true"/>
<Styles><Font name="Ordered List 1" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Annotation Text" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 2" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 3" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 4" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 5" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Author" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Annotation Title" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Warning" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Maple Input Placeholder" background="[255,255,255]" bold="true" executable="true" family="Monospaced" foreground="[200,0,200]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="true"/>
<Font name="Maple Plot" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Code" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[255,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Line Printed Output" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Text Output" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Diagnostic" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[40,120,40]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Inert Output" background="[255,255,255]" bold="false" executable="true" family="Times New Roman" foreground="[144,144,144]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Normal" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[0,128,128]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Maple Output" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Dash Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Math" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Maple Input" background="[255,255,255]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Output" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Input" background="[255,255,255]" bold="false" executable="true" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Header and Footer" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="10" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Error" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[255,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Title" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 1" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Text" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Bullet Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Equation Label" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 4" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[0,0,0]" italic="true" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 3" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="true" opaque="false" readonly="false" size="14" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 2" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="16" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Dictionary Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[147,0,15]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="List Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Layout name="Maple Output" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.3" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Ordered List 1" alignment="left" bullet="numeric" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Dash Item" alignment="left" bullet="dash" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Ordered List 2" alignment="left" bullet="alphabetic" firstindent="0" leftmargin="36" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 3" alignment="left" bullet="roman" firstindent="0" leftmargin="72" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 4" alignment="left" bullet="ALPHABETIC" firstindent="0" leftmargin="108" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 5" alignment="left" bullet="ROMAN" firstindent="0" leftmargin="144" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Author" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="8" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Warning" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Annotation Title" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="12" spacebelow="12" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Maple Plot" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Error" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Title" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="12" spacebelow="12" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Line Printed Output" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="any" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 1" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="4" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Diagnostic" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="any" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Text Output" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="newline" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Bullet Item" alignment="left" bullet="dot" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 4" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Normal" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 3" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 2" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="2" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="List Item" alignment="left" bullet="indent" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Pencil-style name="Pencil 5" pen-color="[255,0,0]" pen-height="5.0" pen-width="5.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 4" pen-color="[0,0,255]" pen-height="3.0" pen-width="3.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 3" pen-color="[0,0,0]" pen-height="3.0" pen-width="3.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 2" pen-color="[0,0,255]" pen-height="1.0" pen-width="1.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 1" pen-color="[0,0,0]" pen-height="1.0" pen-width="1.0" pen-opacity="1.0"/>
<Highlighter-style name="Highlighter 2" pen-color="[255,204,0]" pen-height="14.0" pen-width="14.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 1" pen-color="[255,153,255]" pen-height="12.0" pen-width="8.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 4" pen-color="[0,255,255]" pen-height="32.0" pen-width="32.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 3" pen-color="[51,255,0]" pen-height="24.0" pen-width="24.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 5" pen-color="[255,255,0]" pen-height="48.0" pen-width="48.0" pen-opacity="0.8"/>
</Styles>
<Task-table>
    <Task-category name="&lt;default&gt;">
    </Task-category>
</Task-table>
<Task>
</Task>
<Section collapsed="true" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" layout="Heading 1"><Font size="9">The ASCIIPad procedure</Font></Text-field></Title>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" size="9" layout="Heading 2"><Font size="9">Description</Font></Text-field></Title>
<Text-field style="Normal" size="9" layout="Normal"><Font size="9">This is a procedure for converting ordinary text (plaintext) to padded ASCII numbers. It takes as input a sentence written between ' and ', and also the size parameter &quot;modulus&quot;. Then it chops the sentence into parts so that the padded versions of these parts will be smaller than the size parameter. Then it pads these parts one after another, and returns the padded parts as a list, listed in the order of occurrence of the parts. It 'pads' by adding 100 to each list item.</Font></Text-field>
</Section>
<Text-field style="Normal" size="9" layout="Normal"></Text-field>
<Group labelreference="L14">
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" layout="Normal"><Font size="9">with(numtheory):
ASCIIPad:=proc(Message,Modulus)
local L, K, l, x, y, p, r, M, j, i, z;
  L:= length(Modulus);                         
  K:=convert(Message,bytes);

  l:=nops(K);                                   ##########################################################################
  y:=floor(L/3)-1;                              #Correct here by inserting &quot;-1&quot;. It was just floor(L/3). # April 4, 2007 #
   if ( l mod y = 0) then                       ########################################################################## 
    p:= l/y;
    r:= 0;
   else
    p:= floor(l/y)+1;
    r:= 1;
   fi:
M := [seq(x[i],i=1..p)];
#############################################################################
   if (r = 0) then
    for j from 1 to p do
     x[j]:=0;
     for i from 1 to y do
       if (i &lt; y) then
         x[j]:= (x[j] + (100 + K[(j-1)*y+i]))*1000;   
       else
         x[j]:= (x[j] + (100 + K[j*y]));
       fi:
     od:
    od:
#############################################################################
   elif ( p = 1) then
     x[1]:=0;
     for i from 1 to l do
       if (i &lt; l) then
         x[1]:= (x[1] + (100 + K[i]))*1000;
       else
         x[1]:= (x[1] + (100 + K[i]));
       fi:
      od:
#############################################################################
   else
    for j from 1 to p do
      x[j]:=0;
      if (j &lt; p) then
        for i from 1 to y do
         if (i &lt; y) then
           x[j]:= (x[j] + (100 + K[(j-1)*y+i]))*1000;
         else
           x[j]:= (x[j] + (100 + K[j*y]));
         fi:
        od:
      else
        z := l mod y;
        for i from 1 to z do
          if (i &lt; z) then
            x[j]:= (x[j] + (100 + K[(p-1)*y+i]))*1000;
          else
            x[j]:= (x[j] + (100 + K[(p-1)*y+z]));
          fi:
        od:
      fi:
     od:
   fi:
 RETURN(M):
end:
</Font></Text-field>
</Input>
</Group>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" size="9" layout="Heading 1"><Font size="9">The ReadPadded procedure</Font></Text-field></Title>
<Text-field style="Normal" size="9" layout="Normal"></Text-field>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" size="9" layout="Heading 2"><Font size="9">Description</Font></Text-field></Title>
<Text-field style="Normal" size="9" layout="Normal"><Font size="9">This procedure takes as input the output of ASCIIPad, and returns how many padded ASCII packets there are, as well as the individual packets.</Font></Text-field>
</Section>
<Group labelreference="L24">
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" layout="Normal"><Font size="9">ReadPadded:=proc(X)
 local j:
<Font encoding="UTF-8">  printf(&quot;There are %d packets\134n&quot;,nops(X)):
</Font> for j from 1 to nops(X) do
<Font encoding="UTF-8">  printf(&quot;Packet %d: %d\134n&quot;,j, op(j,X)):
</Font> od:
end:</Font></Text-field>
</Input>
</Group>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" size="9" layout="Heading 1"><Font size="9">The CheckPadding procedure</Font></Text-field></Title>
<Text-field style="Normal" size="9" layout="Normal"></Text-field>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" size="9" layout="Heading 2"><Font size="9">Description</Font></Text-field></Title>
<Text-field style="Normal" size="9" layout="Normal"><Font size="9">This procedure checks a packet in the Padded ASCII list produced by ASCIIPad to see if it really is padded ASCII. The output is &quot;true&quot; if it is padded ASCII, and &quot;false&quot; otherwise.</Font></Text-field>
</Section>
<Group labelreference="L25">
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" layout="Normal"><Font size="9">CheckPadding:=proc(X)
local i, j, Y:
  Y:=X:
  if (length(X) mod 3 &gt; 0) then
    RETURN(false)
  else
    for i from 1 to (length(X)/3) do
      j:= Y mod 1000;
      if (j &lt; 100 or j &gt; 355) then
       RETURN(false):
      fi:
      Y:= (Y - j)/1000:
    od:
    RETURN(true):
  fi:
end:</Font></Text-field>
</Input>
</Group>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" size="9" layout="Heading 1"><Font size="9">The ASCIIDepad procedure</Font></Text-field></Title>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" size="9" layout="Heading 2"><Font size="9">Description</Font></Text-field></Title>
<Text-field style="Normal" size="9" layout="Normal"><Font size="9">The input is a sequence of padded ASCII numbers (packets), and the output is the original message of which these are the packets.</Font></Text-field>
</Section>
<Text-field style="Normal" size="9" layout="Normal"></Text-field>
<Group labelreference="L26">
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" layout="Normal"><Font size="9">ASCIIDepad:=proc(Expression)
local k, l, M, i, j, N, X, Y;
l:=nops(Expression);
Y:=&quot;&quot;:
for j from 1 to l do
   if (CheckPadding(op(j,Expression)) = false) then
<Font encoding="UTF-8">     printf(&quot; This is not a padded ASCII string.\134n&quot;);
</Font>     RETURN(NULL):
   else
     M:= op(j,Expression);
     k:=length(M):
     for i from 1 to (k/3) do
      X[i]:=((M mod 10^(k-3*(i-1)) - (M mod 10^(k-3*i)))/(10^(k-3*i)))-100;
      if (i = 1) then
         N:=[X[i]];
      else
         N:=[op(N),X[i]];
      fi:
     od:
   fi:
   Y:= cat(Y,convert(N,bytes)):
od:
RETURN(Y);
end:</Font></Text-field>
</Input>
</Group>
</Section>
</Section>
<Section collapsed="true" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" size="9" layout="Heading 1"><Font size="9">Fermat Attack</Font></Text-field></Title>
<Group labelreference="L39">
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" layout="Normal"><Font size="9">with(numtheory):
usqrt:=proc(R)</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">local ur:</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">ur:=isqrt(R);</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">if(ur^2&lt;R) then</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">ur:=ur+1:</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">fi:</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">RETURN(ur):</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">end:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L40">
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" layout="Normal"><Font size="9">FermatAttack:=proc(R,r)</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">local x,y,st,sq:</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">st:=usqrt(R):
      for x from st to (st+r) do </Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">          sq:=x^2-R:
            if(issqr (sq)=true) then</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font encoding="UTF-8" size="9">printf(&quot;Factor found in round %d rounds\134n&quot;,x-st+1);
</Font><Font size="9">y:=isqrt(sq):</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">RETURN(x+y):</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">fi:</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">od:</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font encoding="UTF-8" size="9">printf(&quot;No factors found in %d rounds\134R&quot;,r):</Font></Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" size="9" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font size="9">end:</Font></Text-field>
</Input>
</Group><Title>
<Text-field style="Heading 1" size="9" layout="Heading 1"><Font size="9">
</Font></Text-field></Title>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" layout="Heading 1"><Font size="26">RSA cryptosystem</Font></Text-field></Title>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" layout="Heading 2"><Font size="20">Alice makes RSA key</Font></Text-field></Title>
<Group labelreference="L27" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">p:=nextprime(9^51);q:=nextprime(9^51+199);n:=p*q:phin:=(p-1)*(q-1):x:=823727281201: e:=1/x mod phin: <Font encoding="UTF-8">
printf(&quot;PUBLIC KEY:\134n n=%d\134n e=%d\134n\134nPRIVATE KEY:%d\134n&quot;,n,e,x);
</Font></Text-field>
</Input>
<Output>
<Text-field style="2D Output" layout="Maple Output"><Equation executable="false" style="2D Output" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2JVEicEYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1JI21vR0YkNi1RIzo9RicvRjNRJ25vcm1hbEYnLyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0Y9LyUpc3RyZXRjaHlHRj0vJSpzeW1tZXRyaWNHRj0vJShsYXJnZW9wR0Y9LyUubW92YWJsZWxpbWl0c0dGPS8lJ2FjY2VudEdGPS8lJ2xzcGFjZUdRLDAuMjc3Nzc3OGVtRicvJSdyc3BhY2VHRkwtSSNtbkdGJDYkUVI0NjM4Mzk3Njg2NTg4MTAxOTc5MzI4MTUwMTY3ODkwNTkxNDU0MzE4OTY3Njk4MTc5RidGOS8lK2ZvcmVncm91bmRHUShbMCwwLDBdRicvJSlyZWFkb25seUdGPUY5">IlJ6Iilwbio9VlgiZiEqeTtdIkckej41KWUnbyhSUVk=</Equation></Text-field>
</Output>
<Output>
<Text-field style="2D Output" layout="Maple Output"><Equation executable="false" style="2D Output" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2JVEicUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1JI21vR0YkNi1RIzo9RicvRjNRJ25vcm1hbEYnLyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0Y9LyUpc3RyZXRjaHlHRj0vJSpzeW1tZXRyaWNHRj0vJShsYXJnZW9wR0Y9LyUubW92YWJsZWxpbWl0c0dGPS8lJ2FjY2VudEdGPS8lJ2xzcGFjZUdRLDAuMjc3Nzc3OGVtRicvJSdyc3BhY2VHRkwtSSNtbkdGJDYkUVI0NjM4Mzk3Njg2NTg4MTAxOTc5MzI4MTUwMTY3ODkwNTkxNDU0MzE4OTY3Njk4MjYzRidGOS8lK2ZvcmVncm91bmRHUShbMCwwLDBdRicvJSlyZWFkb25seUdGPUY5">IlJqIylwbio9VlgiZiEqeTtdIkckej41KWUnbyhSUVk=</Equation></Text-field>
</Output>
<Output>
<Text-field style="Line Printed Output" layout="Line Printed Output">PUBLIC KEY:
 n=21514733098945856316441287084898149773167909666891634793053927140101627434191087599176402926563077
 e=5961845582634761597404254251537324648550729369485832117593700950678428573698903043708430160403681

PRIVATE KEY:823727281201</Text-field>
</Output>
</Group>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" size="20" layout="Heading 2"><Font size="20">Bob encrypts the message Cyber Security</Font></Text-field></Title>
<Group labelreference="L28" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">text:=&quot;Cyber Security&quot;:<Font encoding="UTF-8">X:=ASCIIPad(text,n):printf(&quot;Cyber Security\134n&quot;):E:=X[1]&amp;^e mod n: printf(&quot;The encrypted message that Bob sends to Alice is %d\134n&quot;,E):</Font></Text-field>
</Input>
<Output>
<Text-field style="Line Printed Output" layout="Line Printed Output">Cyber Security
The encrypted message that Bob sends to Alice is 16154900154973686118089694866378698280069578812849295627767099236869952191142129985694743024950490</Text-field>
</Output>
</Group>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" layout="Heading 2"><Font size="20">Alice decrypts the ciphertext that she received from Bob</Font></Text-field></Title>
<Group labelreference="L29" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">DD:=E&amp;^x mod n:ASCIIDepad(DD);</Text-field>
</Input>
<Output>
<Text-field style="2D Output" layout="Maple Output"><Equation executable="false" style="2D Output">US9DeWJlcn5TZWN1cml0eTYi</Equation></Text-field>
</Output>
</Group>
<Group labelreference="L31" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal"><Equation executable="true" style="2D Input" input-equation="" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2I1EhRicvJStleGVjdXRhYmxlR1EmZmFsc2VGJy8lLG1hdGh2YXJpYW50R1Enbm9ybWFsRic=">JSFH</Equation></Text-field>
</Input>
</Group>
</Section>
<Text-field style="Normal" layout="Normal"></Text-field>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" layout="Heading 1"><Font size="24">Fermat Attack on RSA </Font></Text-field></Title>
<Group labelreference="L41" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">FermatAttack(n,e);</Text-field>
</Input>
<Output>
<Text-field style="Line Printed Output" layout="Line Printed Output">Factor found in round 1 rounds</Text-field>
</Output>
<Output>
<Text-field style="2D Output" layout="Maple Output"><Equation executable="false" style="2D Output">IlJqIylwbio9VlgiZiEqeTtdIkckej41KWUnbyhSUVk=</Equation></Text-field>
</Output>
</Group>
<Group labelreference="L42" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal"><Equation executable="true" style="2D Input" input-equation="" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2I1EhRicvJStleGVjdXRhYmxlR1EmZmFsc2VGJy8lLG1hdGh2YXJpYW50R1Enbm9ybWFsRic=">JSFH</Equation></Text-field>
</Input>
</Group>
</Section>
</Worksheet>
