|
@@ -1,4 +1,4 @@
|
|
|
-//加密工具类,用了3des和base64
|
|
|
+// 加密工具类,用了3des和base64
|
|
|
package utils
|
|
|
|
|
|
import (
|
|
@@ -12,10 +12,10 @@ import (
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
- key = ""
|
|
|
+ key = "6WpHp4vSvLVQK8SLioNZ7WMq"
|
|
|
)
|
|
|
|
|
|
-//des3 + base64 encrypt
|
|
|
+// des3 + base64 encrypt
|
|
|
func DesBase64Encrypt(origData []byte) []byte {
|
|
|
result, err := TripleDesEncrypt(origData, []byte(key))
|
|
|
if err != nil {
|
|
@@ -94,7 +94,7 @@ func PKCS5UnPadding(origData []byte) []byte {
|
|
|
return origData[:(length - unpadding)]
|
|
|
}
|
|
|
|
|
|
-//DES加密
|
|
|
+// DES加密
|
|
|
func DesEncrypt(content string, key string) string {
|
|
|
contents := []byte(content)
|
|
|
keys := []byte(key)
|
|
@@ -121,7 +121,7 @@ func byteToHexString(bytes []byte) string {
|
|
|
return str
|
|
|
}
|
|
|
|
|
|
-//DES解密
|
|
|
+// DES解密
|
|
|
func DesDecrypt(content string, key string) string {
|
|
|
contentBytes, err := hex.DecodeString(content)
|
|
|
if err != nil {
|