工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tools/utils/md5.go

16 lines
274 B

package utils
import (
"crypto/md5"
"fmt"
"io"
)
// Md5 字符串转md5
func Md5(str string) string {
h := md5.New()
io.WriteString(h, str)
// 注意:这里不能使用string将[]byte转为字符串,否则会显示乱码
return fmt.Sprintf("%x", h.Sum(nil))
}