Skip to content

Instantly share code, notes, and snippets.

@iamd3vil
Created February 23, 2016 18:14
Show Gist options
  • Save iamd3vil/5c3891c7bb446a193d45 to your computer and use it in GitHub Desktop.
Save iamd3vil/5c3891c7bb446a193d45 to your computer and use it in GitHub Desktop.
Hmac in Elixir
secret_key = "secret-key"
text = "This is a secret"
hmac = :crypto.hmac(:sha, secret_key, text)
|> Base.encode16
|> String.downcase
IO.puts "HMAC is #{hmac}" # HMAC is 08dc7014b3e778a44af52ea7a16a973a9b48f0dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment