zpywallet.mnemonic package

Submodules

zpywallet.mnemonic.mnemonic module

exception ConfigurationError[source]

Bases: Exception

class Mnemonic(language: str = 'english')[source]

Bases: object

check(mnemonic: str) bool[source]
classmethod detect_language(code: str) str[source]

Scan the Mnemonic until the language becomes unambiguous.

expand(mnemonic: str) str[source]
expand_word(prefix: str) str[source]
generate(strength: int = 128) str[source]

Create a new mnemonic using a random generated number as entropy.

As defined in BIP39, the entropy must be a multiple of 32 bits, and its size must be between 128 and 256 bits. Therefore the possible values for strength are 128, 160, 192, 224 and 256.

If not provided, the default entropy length will be set to 128 bits.

The return is a list of words that encodes the generated entropy.

Parameters:

strength (int) – Number of bytes used as entropy

Returns:

A randomly generated mnemonic

Return type:

str

classmethod list_languages() List[str][source]
static normalize_string(txt: AnyStr) str[source]
to_entropy(words: List[str] | str) bytearray[source]
static to_hd_master_key(seed: bytes, testnet: bool = False) str[source]
to_mnemonic(data: bytes) str[source]
classmethod to_seed(mnemonic: str, passphrase: str = '') bytes[source]
b58encode(v: bytes) str[source]

Module contents

class Mnemonic(language: str = 'english')[source]

Bases: object

check(mnemonic: str) bool[source]
classmethod detect_language(code: str) str[source]

Scan the Mnemonic until the language becomes unambiguous.

expand(mnemonic: str) str[source]
expand_word(prefix: str) str[source]
generate(strength: int = 128) str[source]

Create a new mnemonic using a random generated number as entropy.

As defined in BIP39, the entropy must be a multiple of 32 bits, and its size must be between 128 and 256 bits. Therefore the possible values for strength are 128, 160, 192, 224 and 256.

If not provided, the default entropy length will be set to 128 bits.

The return is a list of words that encodes the generated entropy.

Parameters:

strength (int) – Number of bytes used as entropy

Returns:

A randomly generated mnemonic

Return type:

str

classmethod list_languages() List[str][source]
static normalize_string(txt: AnyStr) str[source]
to_entropy(words: List[str] | str) bytearray[source]
static to_hd_master_key(seed: bytes, testnet: bool = False) str[source]
to_mnemonic(data: bytes) str[source]
classmethod to_seed(mnemonic: str, passphrase: str = '') bytes[source]