封装的方法类

This commit is contained in:
Yun
2023-09-16 20:14:20 +08:00
commit 1bbc7db405
59 changed files with 3671 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package aesx_test
import (
"fmt"
"testing"
"yunink/app/pkg/encryptx/aesx"
)
func TestAes(t *testing.T) {
key := "example key 1234"
plaintext := "exampleplaintext"
ciphertext, err := aesx.AESCBCEncrypt(key, plaintext)
fmt.Println(ciphertext, err)
plaintext, err = aesx.AESCBCDecrypter(key, ciphertext)
fmt.Println(plaintext, err)
///GCM
noncetext := ""
ciphertext, noncetext, err = aesx.AESGCMEncrypt(key, plaintext)
fmt.Println(ciphertext, err)
plaintext, err = aesx.AESGCMDecrypter(key, ciphertext, noncetext)
fmt.Println(plaintext, err)
}