Skip to content

Instantly share code, notes, and snippets.

@lstor
Created April 15, 2015 20:37
Show Gist options
  • Save lstor/ff2d30f4a45a6cb55340 to your computer and use it in GitHub Desktop.
Save lstor/ff2d30f4a45a6cb55340 to your computer and use it in GitHub Desktop.
Compute MD5 hash
defmodule Crypto do
def md5(data) do
:erlang.md5(data)
|> :erlang.bitstring_to_list
|> Enum.map(&(:io_lib.format("~2.16.0b", [&1])))
|> List.flatten
|> :erlang.list_to_bitstring
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment