Kryptonite v0.1.4 Kryptonite.Random View Source
This module provides helper functions related to generating data at random.
Link to this section Summary
Functions
Returns a string at random where the length is equal to length
Hashes a given digest
over itself for as many times as specified by count
Link to this section Functions
Returns a string at random where the length is equal to length
.
Examples
iex> {:ok, data} = bytes(16)
iex> {byte_size(data), bit_size(data)}
{16, 128}
iex> {:ok, data} = bytes(32)
iex> {byte_size(data), bit_size(data)}
{32, 256}
iex> bytes(-1)
{:error, :badarg}
Link to this function
hash_round(digest, count)
View Source
hash_round(binary(), pos_integer()) :: <<_::512>>
Hashes a given digest
over itself for as many times as specified by count
.
Examples
iex> m = "Some message."
iex> hash_round(m, 1) == hash_round(m, 2)
false
iex> hash_round(m, 2) == m |> hash_round(1) |> hash_round(1)
true