In this file on GitHub, from lines 154 to 169, there are twelve arrays of constants that I've not seen in other AES implementations. How do they relate to the algorithm?
$\begingroup$
$\endgroup$
2
-
$\begingroup$ most implementations will generate the tables at runtime, and many will use a single table and then do rotations, instead of doing rotations first with multiple tables like the link, as that uses much more memory and about the same amount of computation $\endgroup$– Richie FrameCommented Feb 6, 2017 at 12:04
-
$\begingroup$ in my implementation I use 8 tables for encryption, 4 for the MDS and 4 for the final subbytes/shiftrows, as you can see from the link, each table occupies 1KB of RAM. I do not use an additional set of tables for decryption key expansion, since I only do that once when the key is changed $\endgroup$– Richie FrameCommented Feb 6, 2017 at 12:36
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
The tables represent the composition of some of the routines from the round function. These tables are used because they facilitate an efficient implementation. These slides and the "Advanced Implementation" section this blog post do a good job of explaining. The table based implementation was also mentioned in the Rijndael AES proposal as well, if I recall correctly.