diff options
author | rsiddharth <s@ricketyspace.net> | 2020-12-06 14:49:32 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-12-06 14:49:32 -0500 |
commit | db55bba1430939130be9aad3e4d54f901b0fac79 (patch) | |
tree | 2b5d7e6351e0639200f933c8586e7e4a5d3e1f22 /lib | |
parent | c0e9feb0e9d78d02c4fb71569db26f31e801d6e3 (diff) |
lib/aes: add AESEncryptECB
Diffstat (limited to 'lib')
-rw-r--r-- | lib/aes.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -19,6 +19,20 @@ func AESDecryptCBC(cipher, key, iv []byte) []byte { return output } +func AESEncryptECB(cipher, key []byte) []byte { + iter := len(cipher) / 16 + + // Encrypt 16 bytes at a time. + output := make([]byte, 0) + for i := 0; i < iter; i++ { + s := (i * 16) + e := (i * 16) + 16 + output = append(output, aesCipher(cipher[s:e], key)...) + } + + return output +} + func AESDecryptECB(cipher, key []byte) []byte { iter := len(cipher) / 16 |