optimize: GetAuthKey

This commit is contained in:
bobo liu 2023-01-14 04:47:39 +08:00
parent 679992db25
commit 4a5be84104
No known key found for this signature in database
GPG Key ID: 51B94E052CB41546

View File

@ -44,9 +44,9 @@ func RandIDWithLen(idLen int) (id string, err error) {
}
func GetAuthKey(token string, timestamp int64) (key string) {
token += fmt.Sprintf("%d", timestamp)
md5Ctx := md5.New()
md5Ctx.Write([]byte(token))
md5Ctx.Write([]byte(strconv.FormatInt(timestamp, 10)))
data := md5Ctx.Sum(nil)
return hex.EncodeToString(data)
}