You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
package utils
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
)
|
|
|
|
// Md5String 生成给定字符串的MD5哈希值并返回十六进制字符串
|
|
func Md5String(str string) string {
|
|
hash := md5.Sum([]byte(str)) // 计算MD5哈希
|
|
return hex.EncodeToString(hash[:]) // 转为十六进制字符串并返回
|
|
}
|