monero_mnemonic_generator

Module for Monero mnemonic generation.

class MoneroMnemonicGeneratorConst

Bases: object

Class container for Monero mnemonic generator constants.

WORDS_NUM_TO_ENTROPY_LEN: Dict[MoneroWordsNum, MoneroEntropyBitLen] = {MoneroWordsNum.WORDS_NUM_12: MoneroEntropyBitLen.BIT_LEN_128, MoneroWordsNum.WORDS_NUM_13: MoneroEntropyBitLen.BIT_LEN_128, MoneroWordsNum.WORDS_NUM_24: MoneroEntropyBitLen.BIT_LEN_256, MoneroWordsNum.WORDS_NUM_25: MoneroEntropyBitLen.BIT_LEN_256}
class MoneroMnemonicGenerator(lang: MoneroLanguages = MoneroLanguages.ENGLISH)

Bases: object

Monero mnemonic generator class. Mnemonic can be generated randomly from words number or from a specified entropy.

m_mnemonic_encoder: MoneroMnemonicEncoder
FromWordsNumber(words_num: Union[int, MoneroWordsNum]) Mnemonic

Generate mnemonic with the specified words number from random entropy.

Parameters:

words_num (int or MoneroWordsNum) – Number of words (12, 13, 24, 25)

Returns:

Generated mnemonic

Return type:

Mnemonic object

Raises:

ValueError – If words number is not valid

FromEntropyNoChecksum(entropy_bytes: bytes) Mnemonic

Generate mnemonic from the specified entropy bytes (no checksum).

Parameters:

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

Returns:

Generated mnemonic (no checksum)

Return type:

Mnemonic object

Raises:

ValueError – If entropy byte length is not valid

FromEntropyWithChecksum(entropy_bytes: bytes) Mnemonic

Generate mnemonic from the specified entropy bytes (with checksum).

Parameters:

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

Returns:

Generated mnemonic (with checksum)

Return type:

Mnemonic object

Raises:

ValueError – If entropy byte length is not valid