mirror of
https://github.com/wonli/aqi.git
synced 2024-06-28 09:57:05 +08:00
26 lines
459 B
Go
26 lines
459 B
Go
package encrypt
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestAes(t *testing.T) {
|
|
t1 := time.Now()
|
|
for i := 0; i < 10000; i++ {
|
|
s, _ := AesEncrypt([]byte("hello world 我是中文"), "hello")
|
|
ss := base64.RawURLEncoding.EncodeToString(s)
|
|
//fmt.Println(ss)
|
|
|
|
ss1, _ := base64.RawURLEncoding.DecodeString(ss)
|
|
_, err := AesDecrypt(ss1, "hello")
|
|
if err != nil {
|
|
t.Error(err.Error())
|
|
}
|
|
}
|
|
|
|
fmt.Println(time.Now().Sub(t1))
|
|
}
|