Skip to content

Instantly share code, notes, and snippets.

@KamilLelonek
Last active April 24, 2018 12:36
Show Gist options
  • Save KamilLelonek/374f6adf05db3a6b16d695214ea1f963 to your computer and use it in GitHub Desktop.
Save KamilLelonek/374f6adf05db3a6b16d695214ea1f963 to your computer and use it in GitHub Desktop.
defp iterate(_mnemonic, round_number, _previous_block, result)
when round_number > @rounds_count,
do: result
defp iterate(mnemonic, round_number, previous_block, result) do
with next_block = :crypto.hmac(:sha512, mnemonic, previous_block),
do: iterate(mnemonic, round_number + 1, next_block, :crypto.exor(next_block, result))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment