Finite Field Arithmetic

For this homework, please submit two pseudo-code samples to answer question 1 and 2 below.

Review sections 4 and 5 in FIPS 197 (see Lab 1) to understand details about finite field arithmetic in AES.

Section 4: Focus on 4.1 and 4.2. 4.3 is less important to study (and more complicated), but it may help you understand section 5.

Section 5: See the high-level pseudo-code for the Cipher algorithm in 5.1. The MixColumns function in 5.1.3 is important to understand. Near the end of that section, it gives you the formulas you need to implement the MixColumns function.

Question 1) Submit pseudo-code for the MixColumns function in 5.1.3. Your submission should demonstrate that you understand how to implement the ideas in section 4. Study these sections and the lecture slides to be able to distinguish between the abstract mathematical ideas (e.g., polynomial representation) and the implementation methodology (i.e., bit shifting, MOD, AND, XOR).﻿

Hint: Start with a Mixcolumns(state) where the state is a 4×4 array of bytes. You can reference each byte with a state(x,y) reference.

Question 2) Submit code for a finite field multiply function that takes two bytes as input and produces a byte as output, the result of multiplying a * b where * is the finite field multiply described in section 4.2. Your code should use an xtime function that is described in 4.2.1.

Hint: Assume a function byte c ffMultiply(byte a, byte b) where the function returns c = a * b. 