NAME

App::FuguSeed::List - the official English word list of BIP39

SYNOPSIS

use App::FuguSeed::List;

my $word   = App::FuguSeed::List->word(0);       # abandon
my $index  = App::FuguSeed::List->index('zoo');  # 2047
my @words  = App::FuguSeed::List->words;
my $digest = App::FuguSeed::List::DIGEST();

DESCRIPTION

App::FuguSeed::List holds the 2048 words of the official English word list of BIP39. The words sit in the module file, one word per line, so a person can diff them against share/fuguseed/english.txt. The index of a word is its 0-based position in the list.

Every method is a class method. The module keeps no state and never logs. It runs on core Perl v5.34 with no dependency, because scripts/pack embeds it in fuguseed-qr.

The module opens no file. The share file is the copy that a person can inspect and replace, and fuguseed-words reads it. The digest check of a list file therefore belongs to that program, not to this module.

word

word($index) returns the word of the 0-based index $index.

index

index($word) returns the 0-based index of $word.

The name repeats a built-in function of Perl, so a caller reaches this method through the arrow only: App::FuguSeed::List->index($word).

words

words() returns the 2048 words as a list, in list order.

CONSTANTS

DIGEST

DIGEST is the SHA-256 of the source list, as lower-case hex. It pins the embedded words and the share file to one number, and the tests hold both copies to it.

RETURN VALUES

word() returns undef for an index outside 0 to 2047, and for an index that is not a whole number. index() returns undef for an unknown word. words() returns 2048 strings.

ERRORS

word() and index() die when the caller gives no argument. The signature of each method requires one, and Perl reports Too few arguments. An unknown word and an index outside the list are recoverable errors, and the caller sees undef.

SEE ALSO

The word list of the BIP39 specification, and share/fuguseed/english.txt, the copy that a person can inspect and replace.

AUTHORS

Dick Olsson <hi@senzilla.io>