|
package utils
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
)
|
|
|
|
// MD5V 计算字节数组的MD5值
|
|
func MD5V(str []byte, b ...byte) string {
|
|
h := md5.New()
|
|
h.Write(str)
|
|
return hex.EncodeToString(h.Sum(b))
|
|
}
|
|
|
|
// MD5String 计算字符串的MD5值
|
|
func MD5String(s string) string {
|
|
return MD5V([]byte(s))
|
|
}
|