🎇 直链url密码哈希

This commit is contained in:
微凉
2021-03-14 19:13:09 +08:00
parent 7076efb6be
commit 5c6344cac0
3 changed files with 25 additions and 1 deletions

18
utils/md5.go Normal file
View File

@ -0,0 +1,18 @@
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加密后的字符串
func Get16MD5Encode(data string) string{
return GetMD5Encode(data)[8:24]
}