Day 4: The Ideal Stocking Stuffer
Section
input = "iwrupvqb"
Stream.iterate(1, &(&1 + 1))
|> Enum.find(fn n ->
string = input <> Integer.to_string(n)
hash = :crypto.hash(:md5, string) |> Base.encode16(case: :lower)
String.starts_with?(hash, "00000")
end)
346386
input = "iwrupvqb"
Stream.iterate(1, &(&1 + 1))
|> Enum.find(fn n ->
string = input <> Integer.to_string(n)
hash = :crypto.hash(:md5, string) |> Base.encode16(case: :lower)
String.starts_with?(hash, "000000")
end)
9958218