bip39_mnemonic_generator

Module for BIP39 mnemonic generation.

class Bip39MnemonicGenerator(lang: Bip39Languages = Bip39Languages.ENGLISH)

Bases: object

BIP39 mnemonic generator class. It generates mnemonics in according to BIP39. Mnemonic can be generated randomly from words number or from a specified entropy.

m_mnemonic_encoder: Bip39MnemonicEncoder
FromWordsNumber(words_num: Union[int, Bip39WordsNum]) Mnemonic

Generate mnemonic with the specified words number from random entropy.

Parameters:

words_num (int or Bip39WordsNum) – Number of words (12, 15, 18, 21, 24)

Returns:

Generated mnemonic

Return type:

Mnemonic object

Raises:

ValueError – If words number is not valid

FromEntropy(entropy_bytes: bytes) Mnemonic

Generate mnemonic from the specified entropy bytes.

Parameters:

entropy_bytes (bytes) – Entropy bytes (accepted lengths in bits: 128, 160, 192, 224, 256)

Returns:

Generated mnemonic

Return type:

Mnemonic object

Raises:

ValueError – If entropy byte length is not valid