mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
21 lines
419 B
Go
21 lines
419 B
Go
package cryptox
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"testing"
|
|
)
|
|
|
|
func TestAesEncrypt(t *testing.T) {
|
|
key := []byte("eyJhbGciOiJIUzI1NiIsInR5")
|
|
data := []byte("SELECT * FROM \"instruct\" OFFSET 0 LIMIT 25;")
|
|
encrypt, err := AesEncrypt(data, key)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
toString := base64.StdEncoding.EncodeToString(encrypt)
|
|
t.Log(toString)
|
|
decrypt, err := AesDecrypt(encrypt, key)
|
|
|
|
t.Log(string(decrypt))
|
|
}
|