summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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