|
@@ -19,9 +19,9 @@ import (
|
19
|
19
|
"errors"
|
20
|
20
|
)
|
21
|
21
|
|
22
|
|
-// MsgEncode 使用 AES CBC 模式加密数据
|
|
22
|
+// AESEncode 使用 AES CBC 模式加密数据
|
23
|
23
|
// data 为待加密数据
|
24
|
|
-func MsgEncode(data, key []byte) ([]byte, error) {
|
|
24
|
+func AESEncode(data, key []byte) ([]byte, error) {
|
25
|
25
|
if nil == data || len(data) == 0 {
|
26
|
26
|
return nil, errors.New("待加密 消息 为空")
|
27
|
27
|
}
|
|
@@ -49,9 +49,9 @@ func MsgEncode(data, key []byte) ([]byte, error) {
|
49
|
49
|
return dist, nil
|
50
|
50
|
}
|
51
|
51
|
|
52
|
|
-// MsgDecode 是 MsgEncode 的反操作, 用来解密数据
|
|
52
|
+// AESDecode 是 AESEncode 的反操作, 用来解密数据
|
53
|
53
|
// data 为待解密数据
|
54
|
|
-func MsgDecode(data, key []byte) ([]byte, error) {
|
|
54
|
+func AESDecode(data, key []byte) ([]byte, error) {
|
55
|
55
|
if nil == data || len(data) == 0 {
|
56
|
56
|
return nil, errors.New("待解密 消息 为空")
|
57
|
57
|
}
|