|
@@ -5,16 +5,14 @@ import (
|
|
|
"testing"
|
|
|
)
|
|
|
|
|
|
-
|
|
|
//加密解密测试
|
|
|
func TestEncrypt(t *testing.T) {
|
|
|
- se := SimpleEncrypt{Key: "topnet"}
|
|
|
- mw:=se.EncodeString("hello world")
|
|
|
- log.Println("密文",mw)
|
|
|
- txt:=se.DecodeString("HAocAgpUAwACAgEA3g=1")
|
|
|
- log.Println("解密后:",txt)
|
|
|
- mw2:=se.Encode2Hex("hello world")
|
|
|
- log.Println("16进制密文",mw2)
|
|
|
- log.Println("解密16进制",se.Decode4Hex(mw2))
|
|
|
- }
|
|
|
-
|
|
|
+ se := SimpleEncrypt{Key: "topnet2015topnet2015"}
|
|
|
+ mw := se.EncodeString("58db529161a0721f1553446a,123444")
|
|
|
+ log.Println("密文", mw)
|
|
|
+ txt := se.DecodeString("QVcUDFBGCwEHBBVfR1xUEgMFBAZAW0YP")
|
|
|
+ log.Println("解密后:", txt)
|
|
|
+ mw2 := se.Encode2Hex("hello world")
|
|
|
+ log.Println("16进制密文", mw2)
|
|
|
+ log.Println("解密16进制", se.Decode4Hex(mw2))
|
|
|
+}
|