Skip to content

Instantly share code, notes, and snippets.

@hahwul
Created January 22, 2021 18:50
Show Gist options
  • Save hahwul/0eb62fd471d6567e004661cf3728bc9b to your computer and use it in GitHub Desktop.
Save hahwul/0eb62fd471d6567e004661cf3728bc9b to your computer and use it in GitHub Desktop.
Go generate token(SHA256)
func MakeToken(url string) string {
now := time.Now()
nanos := now.UnixNano()
sum := sha256.Sum256([]byte(strconv.FormatInt(nanos,10)+url))
data := fmt.Sprintf("%x",string(sum[:]))
return data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment