cardano::Mnemonic class

Represents a BIP39 mnemonic phrase.

Public static functions

static auto generate(size_t mnemonic_size = 24, BIP39Language lang = BIP39Language::English) -> Mnemonic
Generate a new Mnemonic object from random seed.

Constructors, destructors, conversion operators

Mnemonic(std::string_view seed_phrase, BIP39Language lang)
Construct a new Mnemonic object.
Mnemonic(std::span<std::string_view> seed_phrase, BIP39Language lang)
Construct a new Mnemonic object.
Mnemonic(std::span<std::string> seed_phrase, BIP39Language lang)
Construct a new Mnemonic object.
Mnemonic(std::span<std::string_view> seed_phrase, std::span<const uint16_t> word_indexes)
Construct a new Mnemonic object.
Mnemonic(std::span<std::string> seed_phrase, std::span<const uint16_t> word_indexes)
Construct a new Mnemonic object.

Public functions

auto checksum() const -> uint8_t
Get the checksum of the mnemonic.
auto i() const -> const std::vector<uint16_t>&
Constant access to the word indexes.
auto isize() const -> size_t
Get the size of the mnemonic.
auto size() const -> size_t
Get the size of the mnemonic.
auto toEntropy() const -> std::tuple< std::vector< uint8_t >, uint8_t > -> auto
Compute the mnemonic entropy.
auto toSeed() const -> std::vector<uint8_t>
Convert the mnemonic to a seed.
auto verify_checksum() const -> bool
Verify the checksum of the mnemonic.
auto w() const -> const std::vector<std::string>&
Constant access to the word list.

Function documentation

static Mnemonic cardano::Mnemonic::generate(size_t mnemonic_size = 24, BIP39Language lang = BIP39Language::English)

Generate a new Mnemonic object from random seed.

Parameters
mnemonic_size The number of words in the mnemonic.
lang The mnemonic language.
Returns A new Mnemonic object.

cardano::Mnemonic::Mnemonic(std::string_view seed_phrase, BIP39Language lang)

Construct a new Mnemonic object.

Parameters
seed_phrase The mnemonic string value.
lang The mnemonic language.

cardano::Mnemonic::Mnemonic(std::span<std::string_view> seed_phrase, BIP39Language lang)

Construct a new Mnemonic object.

Parameters
seed_phrase The mnemonic as a span of string_view words.
lang The mnemonic language.

cardano::Mnemonic::Mnemonic(std::span<std::string> seed_phrase, BIP39Language lang)

Construct a new Mnemonic object.

Parameters
seed_phrase The mnemonic as a span of string words.
lang The mnemonic language.

cardano::Mnemonic::Mnemonic(std::span<std::string_view> seed_phrase, std::span<const uint16_t> word_indexes)

Construct a new Mnemonic object.

Parameters
seed_phrase The mnemonic as a span of string_view words.
word_indexes The word indexes in the BIP39 dictionary.

cardano::Mnemonic::Mnemonic(std::span<std::string> seed_phrase, std::span<const uint16_t> word_indexes)

Construct a new Mnemonic object.

Parameters
seed_phrase The mnemonic as a span of string words.
word_indexes The word indexes in the BIP39 dictionary.

size_t cardano::Mnemonic::size() const

Get the size of the mnemonic.

Returns Size of the mnemonic.

auto cardano::Mnemonic::toEntropy() const -> std::tuple< std::vector< uint8_t >, uint8_t >

Compute the mnemonic entropy.

Returns A tuple of the entropy as a vector of bytes and the checksum.

std::vector<uint8_t> cardano::Mnemonic::toSeed() const

Convert the mnemonic to a seed.

Returns The seed (entropy) as a vector of bytes.