Mnemo (mnemo v0.1.3) View Source

Implementation of BIP39

Link to this section Summary

Functions

Splits bitstring b into n-bit chunks.

Calculates CS for given ENT. Returns a tuple consisting of the checksum and its bit size.

Decodes unsigned integer from a binary. Bitstrings are left-padded.

Converts English mnemonic to its binary entropy. Validates the provided number of words, their existence in English wordlist and finally, the checksum.

Generates random English mnemonic. Optional entropy length (strength) argument can be provided; defaults to 256 bits.

Retrieves index for an English word. Non-English wordlists are not implemented yet.

Generates English mnemonic for pre-existing entropy (obtained from elsehwere).

Left pads a bitstring with zeros.

Derives a hex-encoded PBKDF2 seed from mnemonic. Optional passhprase can be provided in the second argument.

Returns a list of 11-bit word indices for given ENT_CS.

Retrieves English word by index. Non-English wordlists are not implemented yet.

Link to this section Functions

Splits bitstring b into n-bit chunks.

Calculates CS for given ENT. Returns a tuple consisting of the checksum and its bit size.

Decodes unsigned integer from a binary. Bitstrings are left-padded.

Link to this function

entropy(mnemonic, opts \\ [])

View Source

Converts English mnemonic to its binary entropy. Validates the provided number of words, their existence in English wordlist and finally, the checksum.

If hex: true option is provided, the result is hex-encoded.

Link to this function

generate(strength \\ 256)

View Source

Generates random English mnemonic. Optional entropy length (strength) argument can be provided; defaults to 256 bits.

Link to this function

index(word, lang \\ :english)

View Source

Retrieves index for an English word. Non-English wordlists are not implemented yet.

Generates English mnemonic for pre-existing entropy (obtained from elsehwere).

Left pads a bitstring with zeros.

Link to this function

seed(mnemonic, passphrase \\ "")

View Source

Derives a hex-encoded PBKDF2 seed from mnemonic. Optional passhprase can be provided in the second argument.

Does not validate any mnemonic properties.

Returns a list of 11-bit word indices for given ENT_CS.

Link to this function

word(i, lang \\ :english)

View Source

Retrieves English word by index. Non-English wordlists are not implemented yet.