Files
2021-01-09 20:10:13 +08:00

26 lines
453 B
Go

package aes
import "testing"
const (
key = "IgkibX71IEf382PT"
iv = "IgkibX71IEf382PT"
)
func TestEncrypt(t *testing.T) {
t.Log(New(key, iv).Encrypt("123456"))
}
func TestDecrypt(t *testing.T) {
t.Log(New(key, iv).Decrypt("GO-ri84zevE-z1biJwfQPw=="))
}
func BenchmarkEncryptAndDecrypt(b *testing.B) {
b.ResetTimer()
aes := New(key, iv)
for i := 0; i < b.N; i++ {
encryptString, _ := aes.Encrypt("123456")
aes.Decrypt(encryptString)
}
}