My Thoughts on Python, Elixir, Programming and other stuff

HMAC in Elixir and Python

· by Sarat Chandra · Read in about 1 min · (99 Words)
elixir erlang hmac crypto python

Recently I had to implement HMAC SHA1 using Elixir. It’s pretty simple in Python. Here’s the code in Python3.

I wanted to do the same, but couldn’t find any resource so I went into the Erlang’s crypto module and it has a hmac/3 function which does the same. This is how we can use the erlang module to create a HMAC SHA1 in Elixir.

In the hmac/3 you can also pass :md5, :sha224, :sha256, :sha384, sha512 for different alogorithms. Erlang’s crypto module is awesome and also pretty powerful. This is where, I very much like Elixir and Erlang’s interoperability.