This commit is contained in:
Mrx
2026-04-21 17:03:03 +08:00
parent dad8abad16
commit 3156539319
4 changed files with 59 additions and 30 deletions

View File

@@ -4,9 +4,11 @@ import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/md5"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
)
const (
@@ -119,3 +121,10 @@ func pkcs7Unpadding(src []byte) ([]byte, error) {
return src[:length-unpadding], nil
}
// MD5 使用MD5加密数据返回十六进制字符串
func MD5(data string) string {
h := md5.New()
io.WriteString(h, data)
return hex.EncodeToString(h.Sum(nil))
}