the parent HD public node for which to derive a private node
any non-hardened child private node of the parent
node (only the
privateKey and the
childIndex are required)
an optional object containing an implementation of sha512
Returns the sha512 hash of the provided input.
To incrementally construct a sha512 hash (e.g. for streaming), use
a Uint8Array to be hashed using sha512
Generated using TypeDoc
Derive the HD private node from a HD public node, given any non-hardened child private node.
This exploits the "non-hardened" BIP32 derivation algorithm. Because non-hardened derivation only requires knowledge of the "chain code" (rather than requiring knowledge of the parent private key) it's possible to calculate the value by which the parent private key is "tweaked" to arrive at the child private key. Since we have the child private key, we simply subtract this "tweaked" amount to get back to the parent private key.
The BIP32 "hardened" derivation algorithm is designed to address this weakness. Using hardened derivation, child private nodes can be shared without risk of leaking the parent private node, but this comes at the cost of public node derivation. Given only a parent public node, it is not possible to derive hardened child public keys, so applications must choose between support for HD public node derivation or support for sharing child private nodes.