Skip to content

Instantly share code, notes, and snippets.

@byrnedo
Created September 12, 2016 07:32
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save byrnedo/46489dae775a22e71818950a6a5c9a68 to your computer and use it in GitHub Desktop.
Save byrnedo/46489dae775a22e71818950a6a5c9a68 to your computer and use it in GitHub Desktop.
Compute a hmac for a message in golang
func ComputeHmac256(message string, secret string) string {
key := []byte(secret)
h := hmac.New(sha256.New, key)
h.Write([]byte(message))
return base64.StdEncoding.EncodeToString(h.Sum(nil))
}
@felixd
Copy link

felixd commented Dec 12, 2017

πŸ‘

@march1993
Copy link

πŸ‘

@berkant
Copy link

berkant commented Oct 14, 2018

πŸ‘

@cholthi
Copy link

cholthi commented Sep 1, 2019

πŸ‘

@cbluth
Copy link

cbluth commented Sep 1, 2019

πŸ‘

@lithium555
Copy link

Thank you!

@luqman-v1
Copy link

thankyouu

@nklepatskii
Copy link

πŸ‘

Copy link

ghost commented Sep 22, 2022

✌🏿

@OffenLord
Copy link

πŸ‘

@MystixCode
Copy link

πŸ‘

@lilWe3zy
Copy link

πŸ‘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment