feat: add tool aes
This commit is contained in:
25
tool/aes_test.go
Normal file
25
tool/aes_test.go
Normal file
@ -0,0 +1,25 @@
|
||||
package tool
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAes(t *testing.T) {
|
||||
key := os.Getenv("AES_KEY")
|
||||
|
||||
name := "admin"
|
||||
res, err := AesEncrypt([]byte(name), []byte(key))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Logf("res = %s", string(res))
|
||||
|
||||
raw, err := AesDecrypt(res, []byte(key))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Logf("raw = %s", string(raw))
|
||||
}
|
Reference in New Issue
Block a user