/usr/share/doc/axiom-doc/hypertex/cryptoclass11.xhtml is in axiom-hypertex-data 20120501-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | <?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:m="http://www.w3.org/1998/Math/MathML">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="us-ascii"/>
<title>Axiom Documentation</title>
<style>
html {
background-color: #ECEA81;
}
body {
margin: 0px;
padding: 0px;
}
div.command {
color:red;
}
div.center {
color:blue;
}
div.reset {
visibility:hidden;
}
div.mathml {
color:blue;
}
input.subbut {
background-color:#ECEA81;
border: 0;
color:green;
font-family: "Courier New", Courier, monospace;
}
input.noresult {
background-color:#ECEA81;
border: 0;
color:black;
font-family: "Courier New", Courier, monospace;
}
span.cmd {
color:green;
font-family: "Courier New", Courier, monospace;
}
pre {
font-family: "Courier New", Courier, monospace;
}
</style>
</head>
<body>
<div align="center"><img align="middle" src="doctitle.png"/></div>
<hr/>
<center>
<h2>RCM3720 Cryptography, Network and Computer Security</h2>
<h3>Laboratory Class 11: Finite Fields</h3>
</center>
<hr/>
<ul>
<li> Enter the following definition of the finite field
<pre>
3
Z [x]/(x +x+1)
2
</pre>
<ul>
<li> <span class="cmd">F:=FFP(PF 2,x^3+x+1) </span></li>
</ul>
</li>
<li> To perform field operations, we need to create a generator of the field:
a symbol which can be used to generate all elements as polynomials:
<ul>
<li> <span class="cmd">x:=generator()$F</span>
<br/> Now field arithmetic is easy:
</li>
<li> (x^2+1)(x+1) in the field:
<ul>
<li> <span class="cmd">(x^2+1)*(x+1)</span> </li>
</ul>
</li>
<li> 1/(x^2+x):
<ul>
<li> <span class="cmd">1/(x^2+x)</span>
<br/>Note that Axiom returns its answer in terms of a dummy variable.
</li>
</ul>
</li>
<li> We can also list tables of powers:
<ul>
<li>
<span class="cmd">
for i in 0..7 repeat output (i::String, x^i)
</span>
</li>
</ul>
</li>
</ul>
</li>
<li> Before we enter a new field, we need to clear <tt>x</tt> and its
properties:
<ul>
<li> <span class="cmd">)cl pr x </span></li>
</ul>
Now for a slightly bigger field:
<pre>
4 3
Z [x]/(x +x +1)
2
</pre>
<ul>
<li> <span class="cmd">F2:=FFP(PF 2,x^4+x^3+1)</span> </li>
</ul>
<ul>
<li> Create a list of powers of <tt>x</tt>. </li>
<li> Evaluate (x^3+x+1)/(x^3+x^2) in this field. </li>
</ul>
</li>
<li> Enter the Rijndael field,
<pre>
8 4 3
Z [x]/(x +x +x +x+1)
2
</pre>
and call it <tt>GR</tt>.
</li>
<li> Determine whether <tt>x</tt> is a primitive element in this field:
<ul>
<li> <span class="cmd">x:=generator()$GR</span> </li>
<li> <span class="cmd">primitive?(x)</span> </li>
</ul>
</li>
<li>
Is <tt>x+1</tt> a primitive element?
</li>
<li> Investigate the workings of MixColumn. First create the matrix:
<ul>
<li>
<span class="cmd">
M:Matrix GR:=matrix([[x,x+1,1,1],[1,x,x+1,1],[1,1,x,x+1],[x+1,1,1,x]])
</span>
</li>
</ul>
</li>
<li>
Instead of multiplying a matrix <tt>C</tt> by <tt>M</tt>,
we shall just look at a single column, created randomly:
<ul>
<li>
<span class="cmd">
C:Matrix GR:=matrix([[random()$FR] for j in 1..4])
</span>
</li>
</ul>
<li>
</li>
These can be multiplied directly in Axiom:
<ul>
<li> <span class="cmd">D:=M*C</span> </li>
</ul>
</li>
<li> Remarkably enough, Axiom can operate on matrices over a finite field as
easily as it can operate on numerical matrices. For example, given that
<pre>
D=MC
</pre>
</li>
<li> it follows that
<pre>
-1
C=M D
</pre>
</li>
<li> or that
<pre>
-1
M D-C=0
</pre>
</li>
<li> To test this, first create the matrix inverse:
<ul>
<li> <span class="cmd">MI:=inverse(M)</span> </li>
</ul>
</li>
<li>
Now multiply by <tt>D</tt> and subtract <tt>C</tt>. What does the result
tell you about the truth of the final equation?
</li>
<li> To explore MixColumn a bit more, we shall look at the inverse of
<tt>M</tt>. First, here's a small function which converts from
a polynomial to an integer (treating the coefficients of the
polynomial as digits of a binary number):
<ul>
<li>
<span class="cmd">
poly2int(p)==(tmp:=reverse(coordinates(p)),return
integer wholeRadix(tmp::LIST INT)$RadixExpansion(2))
</span>
</li>
</ul>
</li>
<li> First check the matrix <tt>M</tt>:
<ul>
<li> <span class="cmd">map((x +-> poly2int(x)::INT), M)</span></li>
</ul>
</li>
<li>
Is this what you should have?
</li>
<li>
Now apply the same command but to <tt>MI</tt> instead of to <tt>M</tt>.
What is the result?
</li>
</ul>
</body>
</html>
|