aes_test.go 453 B

12345678910111213141516171819202122232425
  1. package aes
  2. import "testing"
  3. const (
  4. key = "IgkibX71IEf382PT"
  5. iv = "IgkibX71IEf382PT"
  6. )
  7. func TestEncrypt(t *testing.T) {
  8. t.Log(New(key, iv).Encrypt("123456"))
  9. }
  10. func TestDecrypt(t *testing.T) {
  11. t.Log(New(key, iv).Decrypt("GO-ri84zevE-z1biJwfQPw=="))
  12. }
  13. func BenchmarkEncryptAndDecrypt(b *testing.B) {
  14. b.ResetTimer()
  15. aes := New(key, iv)
  16. for i := 0; i < b.N; i++ {
  17. encryptString, _ := aes.Encrypt("123456")
  18. aes.Decrypt(encryptString)
  19. }
  20. }