3

The $Sage$ code for the AES $S-box$ is below and a link is here: Polynomial representation of the affine part of the AES S-box. An online version of $Sage$ to test this is here.

I understand most of it but I cannot understand where the polynomials for $a$ to $h$ come from. Can anyone give a simple example? Even for just one of the polynomials if this will suffice.

enter image description here

Red Book 1
  • 1,025
  • 10
  • 26

2 Answers2

2

This might be a bit off-topic, but I can not yet add a comment:

Note that you can also use the SBox object, included in recent Sage versions (from >= 8.2, I think):

sage: from sage.crypto.sboxes import AES
sage: AES
...

This offers you methods for cryptanalysis etc.

asante
  • 334
  • 3
  • 7
0

$a$ through $h$ are the coefficients of the polynomials for the algebraic expression of the s-box, as determined through Lagrange interpolation.

$S(y) = {'63'} + {'05'}y^{254} + {'09'}y^{253} + {'f9'}y^{251} + {'25'}y^{247} + {'f4'}y^{239} + {'01'}y^{223} + {'b5'}y^{191} + {'8f'}y^{127}$

where $v$ is the affine vector 63, $a$ through $h$ are $05$ through $8f$, and $y$ is the input to the s-box, all in in polynomial form.

Richie Frame
  • 13,278
  • 1
  • 26
  • 42