<p>Your binary (which includes the 4 checksum bits <code>0111</code>, or 7) has the leading null's removed.</p>

<p><code>(0000)1100000 11110001001 00111001011 00100010111 01110111100 11101001010 01011111100 00101001101 01000101111 10001010011 10000110100 00110100111</code></p>

<p>Which is identical to the binary (without checksum bits <code>0111</code>) from the web tool:</p>

<p><code>00001100000 11110001001 00111001011 00100010111 01110111100 11101001010 01011111100 00101001101 01000101111 10001010011 10000110100 0011010....</code></p>

<p>(Note the missing checksum bits .... at the end)</p>

CC BY-SA 4.0
2019-01-29T14:05:05.543Z
I don't understand sorry. My checksum is 7. 7 in binary is 111 `echo "ibase=16; obase=2; 7" | bc`.
monkeyUser
CC BY-SA 4.0
2019-01-29T14:06:36.057Z
If I do `echo "ibase=16; obase=2; 0C1E24E5917779D297E14D45F14E1A1A" | bc`without seven I have `1100000111100010010011100101100100010111011101111001110100101001011111100001010011010100010111110001010011100001101000011010`
Why I have to add 0000 to the beginning?
monkeyUser
CC BY-SA 4.0
2019-01-29T14:07:30.117Z
Yes, 111 = 0111, the leading zeros are always clipped by your command line tool. But you need to maintain all leading bits, even if they are nulls, because we need exact multiples of 11 for the mnemonic key word.
James C.
CC BY-SA 4.0
2019-01-29T14:09:26.250Z
The 0 in `0C1E24E5917779D297E14D45F14E1A1A` is 0000 bits, but these are clipped by the encoding tool. The tool preserves the value of the hex, because the leading null's do not contribute to the value, but we need a fixed-width binary encoding so we always have multiples of 11 bits for the words.
James C.
CC BY-SA 4.0
2019-01-29T14:10:03.620Z
If your entropy were `000E24E5917779D297E14D45F14E1A1A`, it would clip the 12 leading 0 bits.
James C.
CC BY-SA 4.0
2019-01-29T14:17:24.480Z
I'm stupid, 7 in base 2 is 0111 you are right ! But I don't understand why 0 is 0000 bits and I ave to add before my binary sorry
monkeyUser
CC BY-SA 4.0
2019-01-29T14:20:05.227Z
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/88959/discussion-between-monkeyuser-and-james-c).
monkeyUser
CC BY-SA 4.0
2019-01-29T14:58:09.607Z
I have to add padding maybe https://pastebin.com/jUCLmsX8
monkeyUser
CC BY-SA 4.0
2019-01-29T15:03:46.197Z
1hex is 0001bits. The 3 null bits are clipped by your tool.
James C.
CC BY-SA 4.0
2019-01-29T15:04:19.850Z
2hex is 0010bits. The 2 null bits are clipped ...
James C.
CC BY-SA 4.0
2019-01-29T15:05:21.100Z
How many leading nulls are clipped depends on the first hex character.
James C.
CC BY-SA 4.0
2019-01-29T13:59:26.480Z
2019-01-29T14:04:55.433Z
2019-01-29T14:04:55.433Z
James C.
<p>I want to replicate mnemonic code with terminal.
the steps are:</p>

<ol>
<li>Create a random sequence (entropy) of 128 to 256 bits.</li>
<li>Create a checksum of the random sequence by taking the first (entropy- length/32) bits of its SHA256 hash.</li>
<li>Add the checksum to the end of the random sequence.</li>
<li>Divide the sequence into sections of 11 bits.</li>
<li>Map each 11-bit value to a word from the predefined dictionary of 2048 words.</li>
<li>The mnemonic code is the sequence of words.</li>
</ol>

<p>I can see this image </p>

<p><a href="https://i.sstatic.net/AiJ7m.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AiJ7m.png" alt="enter image description here"></a></p>

<p>And I take this entropy</p>

<pre><code>0c1e24e5917779d297e14d45f14e1a1a
</code></pre>

<p>If I follow the image, I create the checksum</p>

<pre><code>printf 0c1e24e5917779d297e14d45f14e1a1a | xxd -r -p | sha256sum -b
</code></pre>

<p>result</p>

<pre><code>76e57a90f93135e97ce700a9e79196ba46315d65e696d0a4518270a8de3e80e4 
</code></pre>

<p>Then take 4 bits (0,5 byte => 1 char ) and append to my entropy with this result:</p>

<pre><code>0c1e24e5917779d297e14d45f14e1a1a7
</code></pre>

<p>Now I have 132 bits And I have to split in 12 segments of 11 bits each</p>

<p>I try to convert in base 2</p>

<pre><code> echo "ibase=16; obase=2; 0C1E24E5917779D297E14D45F14E1A1A7" | bc

11000001111000100100111001011001000101110111011110011101001010010111111000010100110101000101111100010100111000011010000110100111
</code></pre>

<p>But the result is not correct, If I put that entropy in <a href="https://iancoleman.io/bip39/#entropy-notes" rel="nofollow noreferrer">https://iancoleman.io/bip39/#entropy-notes</a> I can see that result </p>

<pre><code>00001100000 11110001001 00111001011 00100010111 01110111100 11101001010 01011111100 00101001101 01000101111 10001010011 10000110100 0011010
</code></pre>

<p>But I don't understand How can I obtain that</p>

<p>00001100000 = 96 = army</p>

CC BY-SA 4.0
2019-01-29T13:41:26.130Z
See the dictionary: https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt 00001100000=96=army, 11110001001=1929=van, etc. Checksum of 0111 (7) seems to be correct as well. Do you get a different binary?
James C.
CC BY-SA 4.0
2019-01-29T13:48:14.013Z
@JamesC. Yes update my question
monkeyUser
CC BY-SA 4.0
2019-01-31T01:10:07.273Z
Take a look at one of the answers under https://bitcoin.stackexchange.com/questions/83883/manually-generating-seed-for-trezor-t/83923#83923.
skaht
<wallet><bip32-hd-wallets><mnemonic-seed>
Calculate mnemonic code from terminal
monkeyUser
# Calculate mnemonic code from terminal

(Asked by: username_0 on 2019-01-29)

I want to replicate mnemonic code with terminal.
the steps are:

Create a random sequence (entropy) of 128 to 256 bits.
Create a checksum of the random sequence by taking the first (entropy- length/32) bits of its SHA256 hash.
Add the checksum to the end of the random sequence.
Divide the sequence into sections of 11 bits.
Map each 11-bit value to a word from the predefined dictionary of 2048 words.
The mnemonic code is the sequence of words.

I can see this image 

And I take this entropy
0c1e24e5917779d297e14d45f14e1a1a

If I follow the image, I create the checksum
printf 0c1e24e5917779d297e14d45f14e1a1a | xxd -r -p | sha256sum -b

result
76e57a90f93135e97ce700a9e79196ba46315d65e696d0a4518270a8de3e80e4 

Then take 4 bits (0,5 byte => 1 char ) and append to my entropy with this result:
0c1e24e5917779d297e14d45f14e1a1a7

Now I have 132 bits And I have to split in 12 segments of 11 bits each
I try to convert in base 2
 echo "ibase=16; obase=2; 0C1E24E5917779D297E14D45F14E1A1A7" | bc

11000001111000100100111001011001000101110111011110011101001010010111111000010100110101000101111100010100111000011010000110100111

But the result is not correct, If I put that entropy in https://iancoleman.io/bip39/#entropy-notes I can see that result 
00001100000 11110001001 00111001011 00100010111 01110111100 11101001010 01011111100 00101001101 01000101111 10001010011 10000110100 0011010

But I don't understand How can I obtain that
00001100000 = 96 = army

**Tags:** wallet, bip32-hd-wallets, mnemonic-seed

> **Comments:**
> **username_1**: See the dictionary: https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt 00001100000=96=army, 11110001001=1929=van, etc. Checksum of 0111 (7) seems to be correct as well. Do you get a different binary?  
> **username_0**: @JamesC. Yes update my question  
> **username_2**: Take a look at one of the answers under https://bitcoin.stackexchange.com/questions/83883/manually-generating-seed-for-trezor-t/83923#83923.  

---

## 1 answers

### Answer by username_1 on 2019-01-29. Score: 1 | Accepted answer

Your binary (which includes the 4 checksum bits `0111`, or 7) has the leading null's removed.

`(0000)1100000 11110001001 00111001011 00100010111 01110111100 11101001010 01011111100 00101001101 01000101111 10001010011 10000110100 00110100111`

Which is identical to the binary (without checksum bits `0111`) from the web tool:

`00001100000 11110001001 00111001011 00100010111 01110111100 11101001010 01011111100 00101001101 01000101111 10001010011 10000110100 0011010....`

(Note the missing checksum bits .... at the end)

> **Comments:**
> **username_0**: I don't understand sorry. My checksum is 7. 7 in binary is 111 `echo "ibase=16; obase=2; 7" | bc`.  
> **username_0**: If I do `echo "ibase=16; obase=2; 0C1E24E5917779D297E14D45F14E1A1A" | bc`without seven I have `1100000111100010010011100101100100010111011101111001110100101001011111100001010011010100010111110001010011100001101000011010` Why I have to add 0000 to the beginning?  
> **username_1**: Yes, 111 = 0111, the leading zeros are always clipped by your command line tool. But you need to maintain all leading bits, even if they are nulls, because we need exact multiples of 11 for the mnemonic key word.  
> **username_1**: The 0 in `0C1E24E5917779D297E14D45F14E1A1A` is 0000 bits, but these are clipped by the encoding tool. The tool preserves the value of the hex, because the leading null's do not contribute to the value, but we need a fixed-width binary encoding so we always have multiples of 11 bits for the words.  
> **username_1**: If your entropy were `000E24E5917779D297E14D45F14E1A1A`, it would clip the 12 leading 0 bits.  
> **username_0**: I'm stupid, 7 in base 2 is 0111 you are right ! But I don't understand why 0 is 0000 bits and I ave to add before my binary sorry  
> **username_0**: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/88959/discussion-between-monkeyuser-and-james-c).  
> **username_0**: I have to add padding maybe https://pastebin.com/jUCLmsX8  
> **username_1**: 1hex is 0001bits. The 3 null bits are clipped by your tool.  
> **username_1**: 2hex is 0010bits. The 2 null bits are clipped ...  
> **username_1**: How many leading nulls are clipped depends on the first hex character.  

---

