This article describes the S-box used by the Rijndael (aka AES) cryptographic algorithm.
Forward S-box
The S-box is generated by determining the multiplicative inverse for a given number in GF(2<sup>8</sup>) = GF(2)/(x<sup>8</sup> + x<sup>4</sup> + x<sup>3</sup> + x + 1), Rijndael's finite field (zero,which has no inverse, is set to zero). The multiplicative inverse is then transformed using the following affine transformation:
The matrix multiplication can be calculated by the following algorithm:
Store the multiplicative inverse of the input number in two 8-bit unsigned temporary variables: s and x.
Rotate the value s one bit to the left; if the value of s had a high bit (eighth bit from the right) of one, make the low bit of s one; otherwise the low bit of s is zero.
Exclusive or the value of x with the value of s, storing the value in x
For three more iterations, repeat steps two and three;......