summaryrefslogtreecommitdiffstats
path: root/lib/aes.go
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-12-06 14:47:21 -0500
committerrsiddharth <s@ricketyspace.net>2020-12-06 14:47:21 -0500
commit89238b1ebae839fb6d22d70dbe32dcdf205db158 (patch)
tree88f99a5d9618f1c469d795d7ee9fe93393b8c19a /lib/aes.go
parent2e81b7e4283b1cc4264d30b06538d03179cbc40f (diff)
lib/aes: add aesSubBytes
Diffstat (limited to 'lib/aes.go')
-rw-r--r--lib/aes.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/aes.go b/lib/aes.go
index a388db8..bd0a86b 100644
--- a/lib/aes.go
+++ b/lib/aes.go
@@ -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++ {