TeachMeBitcoin

Entropy to Mnemonic Math

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

Entropy to Mnemonic Math

Converting a random number into a list of words is a precise mathematical process. It involves creating a random number, adding a checksum to prevent errors, and then splitting that number into 11-bit chunks.

1. Step 1: Generate Entropy

The process starts with a source of randomness called Entropy.

2. Step 2: Add the Checksum

To ensure the words aren't written down incorrectly, a checksum is added to the end of the entropy.

  1. Hash the entropy using SHA256.

  2. Take the first few bits of that hash (1 bit for every 32 bits of entropy).

    • 12 words $\rightarrow$ 4 bits of checksum.
    • 24 words $\rightarrow$ 8 bits of checksum.
  3. Append these bits to the end of your entropy.

3. Step 3: Split into 11-bit Chunks

Now you have a long string of bits (e.g., 128 entropy + 4 checksum = 132 bits).

4. Step 4: Map to the Wordlist

Each of those numbers is used as an index into the BIP39 Wordlist.

Why 11 bits?

The number 11 was chosen because $2^{11} = 2048$. This allows for a wordlist of exactly 2048 words, which is large enough to prevent guessing but small enough to be manageable in code and on paper.

Input Entropy Checksum Bits Total Bits Mnemonic Words
128 Bits 4 132 12 Words
160 Bits 5 165 15 Words
192 Bits 6 198 18 Words
224 Bits 7 231 21 Words
256 Bits 8 264 24 Words

In the next section, we will review the BIP39 English Wordlist.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!