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
-
2$\begingroup$ crypto.stackexchange.com/questions/10996/… $\endgroup$ – kelalaka Oct 13 '18 at 22:33
-
2$\begingroup$ crypto.stackexchange.com/questions/18062/… $\endgroup$ – kelalaka Oct 13 '18 at 22:34
-
$\begingroup$ I used these question as an help, but in vain. can you please help me in this issue?? @kelalaka $\endgroup$ – Irfan Babar Oct 14 '18 at 9:18
-
$\begingroup$ @IrfanBabar This is how the hardware works, and has all of the reduction listing: github.com/bpdegnan/aes/blob/master/aes-sbox/documentation/… $\endgroup$ – b degnan Oct 14 '18 at 17:02
-
$\begingroup$ I have no idea how the hell you made that s-box, but it is not made by finite field inversion, maybe you missed a step $\endgroup$ – Richie Frame Oct 16 '18 at 0:36
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 to63
in the S-box,63
maps to00
in the inverse S-Box54
maps to43
in the S-box,42
maps to64
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