Files
OpenList/utils/md5.go

19 lines
343 B
Go
Raw Normal View History

2021-03-14 19:13:09 +08:00
package utils
import (
"crypto/md5"
"encoding/hex"
)
//返回一个32位md5加密后的字符串
func GetMD5Encode(data string) string {
h := md5.New()
h.Write([]byte(data))
return hex.EncodeToString(h.Sum(nil))
}
//返回一个16位md5加密后的字符串
2021-03-16 23:15:37 +08:00
func Get16MD5Encode(data string) string {
2021-03-14 19:13:09 +08:00
return GetMD5Encode(data)[8:24]
}