2. Consider the finite field GF(16) with irreducible polynomial
m(x) = x4 + x3 + 1. (You'll have to trust me that m(x)
is irreducible over F2 here.) We will, as usual, represent
group elements as either polynomials in x, or a hex number, or
binary strings, with the usual mapping between these representations.
(a) What polynomial corresponds to the hex number 'a'?
(b) What is 'a' + '7' in this field?
(c) What is 'a' * '7' in this field?
(d) What is the additive inverse of 'e' in this field?
(e) What is the multiplicative inverse of 'e' in this field? (Try
elements exhaustively using the xtime() method and show your work.)
3. Now consider the field GF(256) with m(x) as given in class (the same
one used in AES, and in the AES spec). Working here will often be too hard,
so let's write a program to do it for us.
(a) Write a python function that adds two members of this field
(use the "def" command and put this into a library so you can import it
later as needed).
(b) Write a python function for xtime.
(c) Write a python function that multiplies two field elements together.
(Use the xtime function as a subroutine.)
(d) Write a python function that returns the inverse of any non-zero
element of the field (use Euclid's extended algorithm here). This is by
far the hardest of the steps above.
Make sure you verify your code is correct by doing the obvious kinds of checks. For example, if you get that b is the inverse of a, then verify that ab = '01'.
4. Run your program above on these test cases:
(a) '07' + 'ff'
(b) '07' * 'ff' (should be 'cb')
(c) 'c8' * 'a9' (should be '01')
(d) 'cb' * '88'
(e) 'c8'-1 (should be 'a9')
(f) 'aa'-1
(g) (('88' + '33') * 'ab') / ('17' * '91')