Skip to content

Instantly share code, notes, and snippets.

@guedes
guedes / gist:6717736
Created September 26, 2013 17:38 — forked from alco/gist:6715876
# 3 runs
iex(19)> :timer.tc fn -> <<x :: size(128) >> = :crypto.md5("lol"); hd(:io_lib.format("~32.16.0b", [x])) |> iolist_to_binary end
{127, "9cdfb439c7876e703e307864c9167a15"}
iex(20)> :timer.tc fn -> <<x :: size(128) >> = :crypto.md5("lol"); hd(:io_lib.format("~32.16.0b", [x])) |> iolist_to_binary end
{128, "9cdfb439c7876e703e307864c9167a15"}
iex(21)> :timer.tc fn -> <<x :: size(128) >> = :crypto.md5("lol"); hd(:io_lib.format("~32.16.0b", [x])) |> iolist_to_binary end
{98, "9cdfb439c7876e703e307864c9167a15"}
# 3 runs
iex(22)> :timer.tc fn -> bc << char >> inbits :crypto.md5("lol"), do: << integer_to_binary(char, 16) :: binary >> end