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

@@ -315,6 +315,12 @@ func (z *ZhichaService) Decrypt(encryptedData string) (string, error) {
return string(unpadded), nil
}
// MD5 对字符串进行MD5加密并返回32位小写十六进制字符串
func (z *ZhichaService) MD5(data string) string {
hash := md5.Sum([]byte(data))
return hex.EncodeToString(hash[:])
}
// pkcs7Padding 使用PKCS7填充数据
func (z *ZhichaService) pkcs7Padding(src []byte, blockSize int) []byte {
padding := blockSize - len(src)%blockSize