View Source BitcoinLib.Key.HD.SeedPhrase.Checksum (BitcoinLib v0.4.2)

Checksum needed to generate a seed phrase

Source: https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt

Link to this section Summary

Functions

Computes the checksum, which is the first few bits of a SHA256 hash

Adds checksum at the end of the seed

Computes the checksum, and verify that it matches to the one received

Link to this section Functions

Link to this function

compute(binary_seed, nb_bits_to_keep)

View Source
@spec compute(binary(), integer()) :: integer()

Computes the checksum, which is the first few bits of a SHA256 hash

examples

Examples

iex> <<27, 172, 62, 126, 195, 84, 6, 180, 26, 1, 13, 250, 0, 254, 239, 132>>
...> |> BitcoinLib.Key.HD.SeedPhrase.Checksum.compute(4)
2
Link to this function

compute_and_append_to_seed(binary_seed)

View Source
@spec compute_and_append_to_seed(binary()) :: binary()

Adds checksum at the end of the seed

Link to this function

number_of_checksum_bits(binary_seed)

View Source
@spec number_of_checksum_bits(binary()) :: integer()
Link to this function

validate_seed(binary_seed)

View Source
@spec validate_seed(binary()) :: boolean()

Computes the checksum, and verify that it matches to the one received

examples

Examples

iex> <<5, 235, 104, 86, 249, 249, 27, 246, 234, 99, 13, 18, 209, 116, 50, 248, 35>>
...> |> BitcoinLib.Key.HD.SeedPhrase.Checksum.validate_seed()
true