Wikipedia: Rijndael's Forward S-box
I'm writing C Code to generate S-boxes but I'm stuck.
Would you mind explaining one entry of the S-box? (say for x = 0x2
). Here is what I got.
The inverse of $2$ in $GF(2^8)$ for polynomial $x^8 + x^4 + x^3 + x + 1 = 142$ (in decimal). Now if I apply the affine equation, it results in $86$ (0x56
). What's wrong with my approach?
The additive constant for S-Box = 0x63
.
In case it helps and/or makes sense, here's my C code.