From bd9acac9a2cbfd82accdf7378240f965c61cb9bb Mon Sep 17 00:00:00 2001
From: rsiddharth <s@ricketyspace.net>
Date: Sun, 22 Nov 2020 12:42:17 -0500
Subject: lib: aes: add AESDecrypt

---
 lib/aes.go | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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
-- 
cgit v1.2.3