diff options
author | rsiddharth <s@ricketyspace.net> | 2020-12-05 13:35:03 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-12-05 13:35:03 -0500 |
commit | 8f1561128068526e511775af3f5150875ed544a3 (patch) | |
tree | 1a35a8e69f262c1daf9dadfff02e382ec69057e3 /lib/aes.go | |
parent | c301e9ee2dfbfb8e10b3fe26480fb15091d26e2d (diff) |
lib/aes.go: add AESDecryptCBC
Diffstat (limited to 'lib/aes.go')
-rw-r--r-- | lib/aes.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -3,6 +3,22 @@ package lib +func AESDecryptCBC(cipher, key, iv []byte) []byte { + iter := len(cipher) / 16 + + lc := iv + output := make([]byte, 0) + for i := 0; i < iter; i++ { + s := (i * 16) + e := (i * 16) + 16 + c := cipher[s:e] + output = append(output, FixedXORBytes(aesInvCipher(c, key), lc)...) + + lc = c + } + return output +} + func AESDecrypt(cipher, key []byte) []byte { iter := len(cipher) / 16 |