Created
January 22, 2021 18:50
-
-
Save hahwul/0eb62fd471d6567e004661cf3728bc9b to your computer and use it in GitHub Desktop.
Go generate token(SHA256)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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