Browse Source

optimize: GetAuthKey (#3254)

pull/3266/head
bobo liu 2 years ago committed by GitHub
parent
commit
ad3548d332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pkg/util/util/util.go

2
pkg/util/util/util.go

@ -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)
}

Loading…
Cancel
Save