Sunday, December 22, 2024

mnemonic seed – Pseudo code to seek out Bip39 checksum?

I am looking for the checksum for a 12-word BIP39.

I can discover the primary eleven phrases simply high-quality, however my twelfth phrase is all the time off by a number of positions.

For instance, take the 128-bit entropy e84eaa26330ccbb2f866a1dc155e94ba.

In binary that’s 11101000010011101010101000100110001100110000110011001011101100101111100001100110101000011101110000010101010111101001010010111010.

The primary eleven 11-bit phrases are:

11101000010 (bin) => 1858 (decimal) => tribe
01110101010 (bin) => 938  (decimal) => encourage
10001001100 (bin) => 1100 (decimal) => maze
01100110000 (bin) => 816  (decimal) => gravity
11001100101 (bin) => 1637 (decimal) => smile
11011001011 (bin) => 1739 (decimal) => sunny
11100001100 (bin) => 1804 (decimal) => thunder
11010100001 (bin) => 1697 (decimal) => stage
11011100000 (bin) => 1760 (decimal) => swing
10101010111 (bin) => 1367 (decimal) => precedence
10100101001 (bin) => 1321 (decimal) => pioneer

There are nonetheless 7 unused bits, the final ones: 0111010.

The SHA-256 hash of the hex string is 5355d54a3d673c4b1ac20b839ead09af3c6fea6dc24199b477f6ff64e7a68262.
The primary 4 bits of which can be represented by the primary hex character, 5, which in binary is 0101.

I append these 4 bytes to my binary string:
111010000100111010101010001001100011001100001100110010111011001011111000011001101010000111011100000101010101111010010100101110100101

Now I’ve the final 11-bit phrase:

01110100101 (bin) => 933 (decimal) => enter

However when I attempt to validate that in opposition to Ian Coleman’s Bip39 I see the checksum needs to be 0011 (not 0101) and that may make the final phrase be

01110100011 (bin) => 931 (decimal) => inside

What am I doing improper?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles