I'm trying to find the checksum for a 12-word BIP39.
I can find the first eleven words just fine, but my 12th word is always off by a few positions.
For example, take the 128-bit entropy
In binary that is
The first eleven 11-bit words are:
11101000010 (bin) => 1858 (decimal) => tribe 01110101010 (bin) => 938 (decimal) => inspire 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) => priority 10100101001 (bin) => 1321 (decimal) => pioneer
There are still 7 unused bits, the last ones:
The SHA-256 hash of the hex string is
The first 4 bits of that are represented by the first hex character,
5, which in binary is
I append those 4 bytes to my binary string:
Now I have the last 11-bit word:
01110100101 (bin) => 933 (decimal) => input
But when I try to validate that against Ian Coleman's Bip39 I see the checksum should be
0101) and that would make the last word be
01110100011 (bin) => 931 (decimal) => inner
What am I doing wrong?