diff options
author | rsiddharth <s@ricketyspace.net> | 2020-12-06 14:47:21 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-12-06 14:47:21 -0500 |
commit | 89238b1ebae839fb6d22d70dbe32dcdf205db158 (patch) | |
tree | 88f99a5d9618f1c469d795d7ee9fe93393b8c19a /lib | |
parent | 2e81b7e4283b1cc4264d30b06538d03179cbc40f (diff) |
lib/aes: add aesSubBytes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/aes.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -85,6 +85,19 @@ func aesInvMixColumns(state [][]byte) [][]byte { return n_state } +func aesSubBytes(state [][]byte) [][]byte { + nb := 4 + for r := 0; r < 4; r++ { + for c := 0; c < nb; c++ { + x := state[r][c] >> 4 + y := state[r][c] & 0x0f + + state[r][c] = sbox[x][y] + } + } + return state +} + func aesInvSubBytes(state [][]byte) [][]byte { nb := 4 for r := 0; r < 4; r++ { |