an implementation of AES algorithm using golang.
In my implementation, padding uses the PKCS#7, and mode of operation uses the CBC. You can replace these with yours.
中文用户可以在我的博客中了解实现思路。
If you don't have a aes key, you can create one as follows:
// create a 256-bit key
key, _ := NewAesKey(AES256)
// you can also create 128-bit, 192-bit
...
Encrypt:
plainText := "hello, world"
cipherText, err := Encrypt(key, []byte(plainText))
Decrypt:
plainText, err := Decrypt(key, cipherText)
You can also copy code in aes.go
to your file as it will not import new dependency.