5 ms·
Some explanation of the context, and some more solutions, can be found at https://codegolf.stackexchange.com/q/3766 https://codegolf.stackexchange.com/q/3766, i
by pxeger1 4y ago
Some explanation of the context, and some more solutions, can be found at https://codegolf.stackexchange.com/q/3766 https://codegolf.stackexchange.com/q/3766, including a 176 byte solution in Python.
- juliusgeo 4y agoThanks! I took some inspiration from discussion on that page, however my solution differs because instead of hard coding everything it instead calculates the multiplicative inverse and affine transformation separately. This is worse in terms of space but it lets you more clearly represent the two s-boxes as those two operations composed applied element wise to [0, 256]. You can also use this code to do multiplicative inverses over any field GF(2^n), just change the parameters and supply a new irreducible polynomial. I implement the totality of binary finite field arithmetic here: https://gist.github.com/juliusgeo/9e4eff4c0519f7f7b9af122d59a3253e https://gist.github.com/juliusgeo/9e4eff4c0519f7f7b9af122d59...