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!

1 Answer 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.