General This is a tool for generating and analyzing 8-bit substitution boxes.
Nyberg Sbox
  1. Affine transformation    
    x' = (x × 16 mod 116) ⊕ 16
    x' = · x ⊕
  2. Galois Field exponentiation by
    using irreducible polynomial ,
    x'' = x'-1  if x' ≠ 0 mod x8 + x4 + x3 + x + 1
          0     if x' = 0
  3. Affine transformation    
    x''' = (x'' × 16 mod 116) ⊕ 16
    x''' = · x'' ⊕
Custom Sbox
Available functions aes_sbox(input)
aes_inv_sbox(input)
rotl(byte, shift) // rotate left
reverse(byte) // reverse bits
affine(x, matrix, adder)
affine_rot(x, multiplier, adder)
gf_mul(x, y, polynomial = 0)
gf_pow(x, power, polynomial = 0x11B)
gf_inv(x, polynomial = 0x11B)
gf_div(x, y) // Euclidean division, returns [quotient, remainder]
gf_xgcd(x, m = 0x11B) // returns [x^-1 mod m, gcd(x, m)]
xgcd(x, modulus = 257) // for integers
let sbox = new Uint8Array(256) // You should populate this array.

Output
+ 0001020304050607 08090A0B0C0D0E0F
Show analysis: