Skip to content

Instantly share code, notes, and snippets.

@cyantarek
Created May 7, 2019 12:01
Show Gist options
  • Save cyantarek/68f00d11285864a499e6f57ececd6afc to your computer and use it in GitHub Desktop.
Save cyantarek/68f00d11285864a499e6f57ececd6afc to your computer and use it in GitHub Desktop.
// genKey generates 256 random bytes
func genKey() string {
token := make([]byte, 8)
// error checking ommiting for the
// sake of this tutorial
// but you SHOULD not avoid it in production
_, _ = rand.Read(token)
return hex.EncodeToString(token)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment