summaryrefslogtreecommitdiffstats
path: root/lib/aes.go
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-11-22 12:42:17 -0500
committerrsiddharth <s@ricketyspace.net>2020-11-22 12:42:17 -0500
commitbd9acac9a2cbfd82accdf7378240f965c61cb9bb (patch)
tree5f900f0d71def09d932332deaabd8d0f6b94b053 /lib/aes.go
parent32da174d1e7da3366ff8165c20cf7d063e5c40b0 (diff)
lib: aes: add AESDecrypt
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 ebad334..0cc6dfe 100644
--- a/lib/aes.go
+++ b/lib/aes.go
@@ -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