diff options
author | rsiddharth <s@ricketyspace.net> | 2020-11-22 12:42:17 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-11-22 12:42:17 -0500 |
commit | bd9acac9a2cbfd82accdf7378240f965c61cb9bb (patch) | |
tree | 5f900f0d71def09d932332deaabd8d0f6b94b053 /lib | |
parent | 32da174d1e7da3366ff8165c20cf7d063e5c40b0 (diff) |
lib: aes: add AESDecrypt
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 AESDecrypt(cipher, key []byte) []byte { + iter := len(cipher) / 16 + + // Decrypt 16 bytes at a time. + output := make([]byte, len(cipher)) + for i := 0; i < iter; i++ { + s := (i * 16) + e := (i * 16) + 16 + output = append(output, AESInvCipher(cipher[s:e], key)...) + } + return output +} + func AESInvCipher(in, ky []byte) []byte { nb := 4 nr := 10 |