feat: add tool aes

This commit is contained in:
zhaoyupeng
2025-07-16 18:51:52 +08:00
parent 868b959c6f
commit 104745e260
2 changed files with 120 additions and 0 deletions

25
tool/aes_test.go Normal file
View 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))
}