module Bip0039::Util
Overview
A collection of utilities for Bip0039
mnemonic management, e.g.,
loading word lists from dictionaries, or n-bit padding operations.
Defined in:
util.crClass Method Summary
-
.bin_to_padded_hex(bin : String, size : Int) : String
A generic utility to generate a padded hex string from a binary string with given size.
-
.hex_to_padded_bin(hex : String, size : Int) : String
A generic utility to generate a padded binary string from a hex string with given size.
-
.num_to_padded_bin(num : BigInt | Int, size : Int) : String
A generic utility to generate a padded binary string from a big number with given size.
-
.num_to_padded_hex(num : BigInt | Int, size : Int) : String
A generic utility to generate a padded hex string from a big number with given size.
-
.word_list : Array(String)
A generic utility to load the standardized english language word list from file.
Class Method Detail
A generic utility to generate a padded hex string from a binary string with given size.
Parameters:
bin
(String
): the binary string to be formatted as padded hex string.size
(Int
): the size in bits for the resulting hex string, e.g., 128.
Bip0039::Util.bin_to_padded_hex "1100101", 32
# => "00000065"
A generic utility to generate a padded binary string from a hex string with given size.
Parameters:
hex
(String
): the hex string to be formatted as padded binary string.size
(Int
): the size in bits for the resulting hex string, e.g., 128.
Bip0039::Util.hex_to_padded_bin "69", 32
# => "00000000000000000000000001101001"
A generic utility to generate a padded binary string from a big number with given size.
Parameters:
num
(BigInt | Int
): the number to be formatted as padded binary string.size
(Int
): the size in bits for the resulting hex string, e.g., 128.
Bip0039::Util.num_to_padded_bin 137, 32
# => "00000000000000000000000010001001"
A generic utility to generate a padded hex string from a big number with given size.
Parameters:
num
(BigInt | Int
): the number to be formatted as padded hex string.size
(Int
): the size in bits for the resulting hex string, e.g., 128.
Bip0039::Util.num_to_padded_hex 137, 32
# => "00000089"
A generic utility to load the standardized english language word list from file.
Bip0039::Util.word_list
# => ["abandon", "ability", "able", "about", "above", ...