mirror of https://github.com/Xhofe/alist
19 lines
289 B
Go
19 lines
289 B
Go
![]() |
package utils
|
||
|
|
||
|
import (
|
||
|
"crypto/md5"
|
||
|
"encoding/hex"
|
||
|
)
|
||
|
|
||
|
// GetMD5Encode
|
||
|
func GetMD5Encode(data string) string {
|
||
|
h := md5.New()
|
||
|
h.Write([]byte(data))
|
||
|
return hex.EncodeToString(h.Sum(nil))
|
||
|
}
|
||
|
|
||
|
// Get16MD5Encode
|
||
|
func Get16MD5Encode(data string) string {
|
||
|
return GetMD5Encode(data)[8:24]
|
||
|
}
|