Skip to content

Instantly share code, notes, and snippets.

@iyear
Last active September 11, 2021 14:26
Show Gist options
  • Save iyear/5e0715c7d869414e04879d0e259b9825 to your computer and use it in GitHub Desktop.
Save iyear/5e0715c7d869414e04879d0e259b9825 to your computer and use it in GitHub Desktop.
HDUHelp HealthCheck Sign
func getSign(staffName string, staffID int64, ts int64, province int, city int, country int) string {
s := staffName +
base64.StdEncoding.EncodeToString([]byte(strconv.FormatInt(staffID, 10))) +
strconv.FormatInt(ts, 10) +
base64.StdEncoding.EncodeToString([]byte(strconv.Itoa(province))) +
strconv.Itoa(city) +
strconv.Itoa(country)
return SHA1(s)
}
func SHA1(s string) string {
o := sha1.New()
o.Write([]byte(s))
return hex.EncodeToString(o.Sum(nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment