Created
April 15, 2015 20:37
-
-
Save lstor/ff2d30f4a45a6cb55340 to your computer and use it in GitHub Desktop.
Compute MD5 hash
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
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