Created
February 23, 2016 18:14
-
-
Save iamd3vil/5c3891c7bb446a193d45 to your computer and use it in GitHub Desktop.
Hmac in Elixir
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
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