View Source BitcoinLib.Key.HD.Entropy (BitcoinLib v0.4.1)

Computing entropy from different sources, mostly for seed phrase creation

Link to this section Summary

Functions

Takes a list of dice rolls as a string argument, having values ranging from 0 to 5, transforming them into a single integer that could serve as entropy for seed phrase creation

Takes a list of dice rolls as a string argument, having values ranging from 0 to 5, transforming them into a single integer that could serve as entropy for seed phrase creation

Link to this section Functions

Link to this function

from_dice_rolls!(dice_rolls)

View Source
@spec from_dice_rolls!(binary()) :: integer()

Takes a list of dice rolls as a string argument, having values ranging from 0 to 5, transforming them into a single integer that could serve as entropy for seed phrase creation

examples

Examples

iex> "12345612345612345612345612345612345612345612345612"
...> |> BitcoinLib.Key.HD.Entropy.from_dice_rolls!()
32_310_461_525_491_050_757_677_748_469_648_273_221
Link to this function

from_dice_rolls(dice_rolls)

View Source
@spec from_dice_rolls(binary()) :: {:ok, integer()} | {:error, binary()}

Takes a list of dice rolls as a string argument, having values ranging from 0 to 5, transforming them into a single integer that could serve as entropy for seed phrase creation

examples

Examples

iex> "12345612345612345612345612345612345612345612345612"
...> |> BitcoinLib.Key.HD.Entropy.from_dice_rolls()
...> |> elem(1)
32_310_461_525_491_050_757_677_748_469_648_273_221