diff options
author | rsiddharth <s@ricketyspace.net> | 2020-11-21 11:47:54 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-11-21 11:47:54 -0500 |
commit | 32a0b4c2f0e1fd38058b22b23acc8180229be3e6 (patch) | |
tree | 58340a5e9f60e6ed021f2f5e3909d360113cfa3e /lib | |
parent | 1523fdf8bfa5e6b02f9b541714130f910c106202 (diff) |
lib: aes: add InvShiftRows
Diffstat (limited to 'lib')
-rw-r--r-- | lib/aes.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -3,6 +3,19 @@ package lib +func InvShiftRows(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+r)%nb] = state[r][c] + } + } + return n_state +} + func AddRoundKey(state, ks [][]byte) [][]byte { if len(ks) != 4 { return state |