I read Pseudo code to find Bip39 checksum? and followed the steps outlined by the answer and arrived at the correct checksum.

But when I went to try it on a 128 bit entropy that were all 1s: 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

I got the wrong checksum (checking with https://iancoleman.io/bip39/ and https://learnmeabitcoin.com/technical/mnemonic).

On ubuntu 20.04, I ran:

echo "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" | shasum -a 256 -b

and my hash was 951354377d60faddeaf27bbc864565a2fef8db8da4b4bdf5c21a2c6f6ac9a06f

so, reading from the Bip39 spec (https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#Generating_the_mnemonic), it says "A checksum is generated by taking the first ENT / 32 bits of its SHA256 hash. This checksum is appended to the end of the initial entropy."

So I took the first four bits of the hash, 9 in hex is 1001, and appended it to the 128 1s so now the checksum word should be 11111111001, and checking it on https://github.com/hatgit/BIP39-wordlist-printable-en/blob/master/BIP39-en-printable.txt tells me that my checksum word should be "you".

Therefore, shouldn't my 12 word mnemonic now be: zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo you ?

But importing the 128 1s as entropy into https://iancoleman.io/bip39/ (checking the box for "Show entropy details"), tells me my last word should be "wrong", so "you" is incorrect.

Can someone please point out what I'm doing wrong? This is driving me a little crazy. Thanks!

1 Answer 1


To read a string of bits with shasum you need to use -0, not -b:

echo "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" | shasum -a 256 -0

The hash comes out as 5ac6a5945f16500911219129984ba8b387a06f24fe383ce4e81a73294065461b which indeed makes the last word "wrong".

  • Thanks! So this means that chytrik (answering bitcoin.stackexchange.com/questions/99765/…), was using the wrong command line flags for shasum but got the correct first four bits, he got 3043b02ceb37bb00ab48c91f76bb23d487e1ec822c90e1575967e8838a655f7c when he should have gotten 3beeaf4009651c2fdcf083ddc2ae8f224e74f1adc40bbc1783ebf4bac56e20b7 (funny how it has beeaf in it).
    – ssocolow
    Jan 9, 2022 at 23:47

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.