keys/hd/address.go
func DerivePrivateKey(privKeyBytes []byte, chainCode []byte, index uint32, prime bool) ([]byte, []byte) {
	var data []byte
	if prime {
		index = index | 0x80000000
		data = append([]byte{byte(0)}, privKeyBytes...)
	} else {
		public := PubKeyBytesFromPrivKeyBytes(privKeyBytes, true)
		data = public
	}
	data = append(data, uint32ToBytes(index)...)
	data2, chainCode2 := I64(chainCode, data)
	x := addScalars(privKeyBytes, data2)
	return x, chainCode2
}
func DerivePrivateKey(privKeyBytes []byte, chainCode []byte, index uint32, prime bool) ([]byte, []byte) {
	var data []byte
	if prime {
		index = index | 0x80000000
		data = append([]byte{byte(0)}, privKeyBytes...)
	} else {
		public := PubKeyBytesFromPrivKeyBytes(privKeyBytes, true)
		data = public
	}
	data = append(data, uint32ToBytes(index)...)
	data2, chainCode2 := I64(chainCode, data)
	x := addScalars(privKeyBytes, data2)
	return x, chainCode2
}
func DerivePrivateKey ( privKeyBytes [ ] byte , chainCode [ ] byte , index uint32 , prime bool ) ( [ ] byte , [ ] byte ) { var data [ ] byte if prime { index = index | 0x80000000 data = append ( [ ] byte { byte ( 0 ) } , privKeyBytes ... ) } else { public := PubKeyBytesFromPrivKeyBytes ( privKeyBytes , true ) data = public } data = append ( data , uint32ToBytes ( index ) ... ) data2 , chainCode2 := I64 ( chainCode , data ) x := addScalars ( privKeyBytes , data2 ) return x , chainCode2 }
// DerivePrivateKey derives the private key with index and chainCode.
// If prime is true, the derivation is 'hardened'.
// It returns the new private key and new chain code.
DerivePrivateKey derives the private key with index and chainCode . If prime is true the derivation is hardened . It returns the new private key and new chain code .