diff options
author | rsiddharth <s@ricketyspace.net> | 2020-12-06 14:46:30 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-12-06 14:46:30 -0500 |
commit | 2e81b7e4283b1cc4264d30b06538d03179cbc40f (patch) | |
tree | 7228914cedb0265bc53c6704e5839bb98f5d6815 /lib | |
parent | 08fd8ad89102fc6b0a1b558c96bc8b845142dac1 (diff) |
lib/aes: add aesShiftRows
Diffstat (limited to 'lib')
-rw-r--r-- | lib/aes.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -98,6 +98,20 @@ func aesInvSubBytes(state [][]byte) [][]byte { return state } +func aesShiftRows(state [][]byte) [][]byte { + n_state := make([][]byte, 4) // New state. + + nb := 4 + for r := 0; r < 4; r++ { + n_state[r] = make([]byte, nb) + for c := 0; c < nb; c++ { + n_state[r][c] = state[r][(c+r)%nb] + + } + } + return n_state +} + func aesInvShiftRows(state [][]byte) [][]byte { n_state := make([][]byte, 4) // New state. |