2

How do I generate 25/13 mnemonics from a random number?

I know how to generate Bitcoin style mnemonics with BIP39 (https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki). However, Monero seems not using BIP-39 convention...

Is there any guidance that I can consult? Thanks!

Mooooo
  • 459
  • 2
  • 8

1 Answers1

1

The source is the only documentation I'm aware of for this. See bytes_to_words in electrum-words.cpp. Every 4 bytes of the number (which is just taken as a byte array), converts to 3 words:

    w[0] = SWAP32LE(*(const uint32_t*)(src + (i * 4)));

    w[1] = w[0] % word_list_length;
    w[2] = ((w[0] / word_list_length) + w[1]) % word_list_length;
    w[3] = (((w[0] / word_list_length) / word_list_length) + w[2]) % word_list_length;

Where w[1], w[2] and w[3] are indexes to words in the selected language word_list.

jtgrassie
  • 19,111
  • 4
  • 14
  • 51