def aes.sbox

bend-osdev-cipher-modes@0.1.0.0 · aes.bend:48

import bend-osdev-cipher-modes@0.1.0.0/aes.bend as Aes
import 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)

Uses (5)

Used by (1)