🎇 直链url密码哈希
This commit is contained in:
18
utils/md5.go
Normal file
18
utils/md5.go
Normal 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]
|
||||
}
|
Reference in New Issue
Block a user