5.1.2 Byte Multiplication
In the AES algorithm, byte multiplication is defined as finite field multiplication with modulus 0x11B (binary 1 0001 1011). A suggested implementation is to repetitively multiply the first factor by 2 (modulo 0x11B) and sum up the intermediate results for each bit in the second factor having value 1.
An example: If the second factor is 0x1A (binary 0001 1010), then the first, third, and fourth intermediate results should be summed.
Another example is shown in the following figure. This method uses little memory and is well suited for an 8-bit microcontroller.
bitmask = 1
tempresult = 0
tempfactor = firstfactor
while bitmask < 0x100
if bitmask AND secondfactor <> 0
add tempfactor to tempresult using XOR
end if
shift bitmask left once
multiply tempfactor by 2 modulo 0x11B
end while
return tempresult