Cryptography Reference
In-Depth Information
F
2
8
. This particular polynomial is especially convenient because it is
Thus we initialize this field as:
define the field
> F256 := GF(2, 8, xˆ8+xˆ4+xˆ3+x+1):
If the field is defined by the command
F := GF(p, n)
, i.e., if the irreducible
polynomial is not specified, then Maple chooses an irreducible polynomial which
need not be the “first” one. The irreducible polynomial used by Maple in this case is
given by the command
F[extension]
.
Exercise 2.36
Define
G
:=
GF
(
2
,
8
)
and find the irreducible polynomial used by
Maple to construct this field.
The package
GF
has several commands to convert field elements between the
different formats they can take. The elements of
F
2
8
are binary polynomials of
degree less than 8 and, as we have mentioned before, there is a natural bijective
correspondence between them and the integers in the 0
255 range, and also with
the set of bit strings or lists of length 8 which are the binary representations of these
integers. These bit strings are commonly referred to as
bytes
so we freely use this
term—as we have already been doing—to denote the integers in the 0
..
255 range
when regarded as elements of this field. The Maple functions that convert between
these integers and polynomials modulo 2 are
F256:-input
and
F256:-output
(assuming that we defined the field
F256
with the command above) so that, for
example, in Maple v13 or later we have
9
:
> F256:-input
∼
([$127 .. 132)]);
[(xˆ6 + xˆ5 + xˆ4 + xˆ3 + xˆ2 +x+1)mod2,xˆ7mod2,(xˆ7 + 1) mod 2,
(xˆ7 + x) mod 2, (xˆ7 +x+1)mod2,(xˆ7 + xˆ2) mod 2]
Now we can go back from binary polynomials to integers as follows:
> F256:-output
∼
(%)
..
[127, 128, 129, 130, 131, 132]
Note that the outputs of the function
F256:-input
are polynomials modulo 2
(or, more generally, modulo
p
), and for doing arithmetic with these polynomials
one should use the
modp1
function of Maple. For example, let
> g := F256:-input(7);
(xˆ2 +x+1)mod2
Then, if we want to check whether
g
is irreducible
Irreduc(g) mod 2
would
fail, as
g
is already a binary polynomial, so we would use
modp1
instead:
> modp1(Irreduc(g), 2);
true
Maple also has commands
F256:-ConvertIn
and
F256:-ConvertOut
to
convert from modulo 2 polynomials to ordinary polynomials and vice versa. For
example:
9
In Maple versions prior to v13 the elementwise operator ~ is not available and so one would use
map
instead to make these conversion functions act on the elements of a list.