<p>There is concatenation where 256 bits placed next to another 256 bits makes 512 bits. However, what you are referring to (generating a child key) uses scalar addition. A 256 bit number (256 bit parent private key) is added to another 256 bit number (left 256 bits of the SHA512) and the result modulo p (<code>p = 2^256-2^32-977</code>) is another 256 bit number.</p>

CC BY-SA 4.0
2022-10-04T20:27:14.473Z
So we will hash  that 512 bits using SHA256 to get the private key?
Athul A
CC BY-SA 4.0
2022-10-04T21:21:18.543Z
@AthulA: No as I say in the answer you add the 256 bit parent private key to the left 256 bits of the SHA512 modulo p. The result is 256 bits. If you need an explanation of modular arithmetic this might be helpful https://github.com/jimmysong/programmingbitcoin/blob/master/ch01.asciidoc#modulo-arithmetic
Michael Folkson
CC BY-SA 4.0
2023-04-04T12:58:07.650Z
@MichaelFolkson Hi Michael, are you sure that concatenation should be used and not regular addition? [Here](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#private-parent-key--private-child-key) they say that the + operation is performed between the left side of the hash and the parent's private key. However, nowhere is it indicated that this is a special type of addition. The only thing indicated is that if you work with coordinates, then the `+` indicates a "special operation" (`Addition (+) of two coordinate pair is defined as application of the EC group operation.`).
dassd
CC BY-SA 4.0
2023-04-04T13:07:14.507Z
@Filip: I explain the difference between concatenation and scalar addition in the answer. And yes the question asker was mistaken in assuming concatenation should be used here. So me and you are in agreement (maybe the answer could be worded a little better)
Michael Folkson
CC BY-SA 4.0
2023-04-04T13:09:58.460Z
@MichaelFolkson My fault then. I misinterpreted your answer. All the best!
dassd
CC BY-SA 4.0
2022-09-27T21:09:55.257Z
2023-04-04T13:08:25.927Z
2023-04-04T13:08:25.927Z
Michael Folkson
<p>So in mastering bitcoin it mentioned that to generate child key,The left-half 256 bits of the hash are added to the parent key so if we add that it will be 512 bits.But we need 256 bit so do we hash that string (parent key + left hash) with SHA256 and get the 256 bit child private key?</p>

<wallet><private-key><bip32-hd-wallets><public-key>
The left-half 256 bits of the hash are added to the parent key to produce the child private key
Athul A
# The left-half 256 bits of the hash are added to the parent key to produce the child private key

(Asked by: username_0 on 2022-09-27)

So in mastering bitcoin it mentioned that to generate child key,The left-half 256 bits of the hash are added to the parent key so if we add that it will be 512 bits.But we need 256 bit so do we hash that string (parent key + left hash) with SHA256 and get the 256 bit child private key?

**Tags:** wallet, private-key, bip32-hd-wallets, public-key


---

## 1 answers

### Answer by username_1 on 2022-09-27. Score: 2

There is concatenation where 256 bits placed next to another 256 bits makes 512 bits. However, what you are referring to (generating a child key) uses scalar addition. A 256 bit number (256 bit parent private key) is added to another 256 bit number (left 256 bits of the SHA512) and the result modulo p (`p = 2^256-2^32-977`) is another 256 bit number.

> **Comments:**
> **username_0**: So we will hash  that 512 bits using SHA256 to get the private key?  
> **username_1**: @username_0: No as I say in the answer you add the 256 bit parent private key to the left 256 bits of the SHA512 modulo p. The result is 256 bits. If you need an explanation of modular arithmetic this might be helpful https://github.com/jimmysong/programmingbitcoin/blob/master/ch01.asciidoc#modulo-arithmetic  
> **username_2**: @username_1 Hi username_1, are you sure that concatenation should be used and not regular addition? [Here](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#private-parent-key--private-child-key) they say that the + operation is performed between the left side of the hash and the parent's private key. However, nowhere is it indicated that this is a special type of addition. The only thing indicated is that if you work with coordinates, then the `+` indicates a "special operation" (`Addition (+) of two coordinate pair is defined as application of the EC group operation.`).  
> **username_1**: @Filip: I explain the difference between concatenation and scalar addition in the answer. And yes the question asker was mistaken in assuming concatenation should be used here. So me and you are in agreement (maybe the answer could be worded a little better)  
> **username_2**: @username_1 My fault then. I misinterpreted your answer. All the best!  

---

