def aes.sbox
import bend-osdev-cipher-modes@0.1.0.0/aes.bend as Aesimport Base
48# the S-box: the inverse, then the affine map
49def aes.sbox(+x: U32) -> U32:
50 +b = aes.inv(U32.and(255, x))
51 U32.xor(U32.xor(U32.xor(U32.xor(U32.xor(b, aes.rotl(b, 1n)), aes.rotl(b, 2n)), aes.rotl(b, 3n)), aes.rotl(b, 4n)), 99)