Browse Source

测试

master
loshiqi 1 month ago
parent
commit
a980fe1e9e
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      aes_test.go

+ 5
- 4
aes_test.go View File

@ -7,12 +7,13 @@ import (
func Test_EncryptAES(t *testing.T) {
// 要加密的明文
str := `{"open_id":"op2kh5PTc2-4u3XaADjjbkxeXPn0","userName":"山野雾灯"}`
//str := `{"open_id":"op2kh5PTc2-4u3XaADjjbkxeXPn0","userName":"山野雾灯"}`
// 密钥,AES 支持 16、24 或 32 字节的密钥
key := "0123456789abcdef0123456789abcdef"
ret, err := EncryptAES(str, key)
key := "0123456789shopef0123456789shopef"
/*ret, err := EncryptAES(str, key)
t.Log(err)
t.Log(ret)
t.Log(ret)*/
ret := "jpWI1PWjg9GKmSMRv8WiuL4CI/vZG3xgTfOiLrbY8ZK+T8poUgK7fFPkj7H2tGSHbB1A/ucOjjSwEvbQDYZfOw=="
res, err := DecryptAES(ret, key)
t.Log(err)
t.Log(string(res))


Loading…
Cancel
Save