Entropy to Mnemonic Math
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.
-
For a 12-word phrase, you need 128 bits of entropy.
-
For a 24-word phrase, you need 256 bits of 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.
-
Hash the entropy using SHA256.
-
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.
-
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).
-
Split this string into groups of 11 bits.
-
$132 \div 11 = 12$ groups.
-
Each group of 11 bits represents a number between 0 and 2047.
4. Step 4: Map to the Wordlist
Each of those numbers is used as an index into the BIP39 Wordlist.
-
If your first 11 bits are
00000000000, the first word isabandon(index 0). -
If your bits are
11111111111, the word iszoo(index 2047).
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.
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: