# How we can calculate AES Inverse SBox?

I am trying to find out the inverse of and SBox, but in vain, I have seen multiple questions over StackExchange, But I cant be able to solve my issue. As in this question, How are the AES inverse S-Boxes calculated? As in this link I followed all the procedure and I made a 16x16 Matrix of inverse. But When I multiplied two(Multiplication in GF-2^8) corresponding entries against a SBox value to a inverse SBox value. If this is true in that question then my multiplication would be resulted into 1. But it is not resulting into 1. I used X = 0x52. Sbox Generated with C = 0x63 is given Below

S-Box's are invertible. The inverse S-box is simply the S-box run in reverse.

One way to calculate the inverse of an S-box is; all you need to use the S-Box itself to find an element's inverse.

For example; look at the Wikipedia example.

• 00 maps to 63 in the S-box, 63 maps to 00 in the inverse S-Box
• 54 maps to 43 in the S-box, 42 maps to 64 in the inverse S-Box

This can be executed by passing only once the elements of the S-Box. The complexity will be $$\mathcal{O}(n^2)$$ where $$n$$ is the $$row=column$$ size of the matrix.

You missed the most important step in s-box generation, the nonlinear step.

I tested both s-boxes you generated, they are both 100% linear (nonlinearity of 0), which means you did not perform the finite field inversion as the final step in generating your inverse s-box.

As for your forward s-box, I do not know what affine transform you used, but since 0x00 before the affine transform is 0x00 after, your vector addition was 0x77, rather than 0x63, or you may possibly have other problems in the calculation