The path derivation for hardened paths was calculated wrong in earlier versions of coinb.in. Please select the old path derivation to recover HD wallet keys generated with older version of coinb.in.
+
+
+
+
+
+
+
diff --git a/js/coin.js b/js/coin.js
index d8f5388f..3e1aa924 100644
--- a/js/coin.js
+++ b/js/coin.js
@@ -18,6 +18,8 @@
coinjs.compressed = false;
+ coinjs.hd_derivation = "bip32_derivation";
+
/* other vars */
coinjs.developer = '33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G'; //bitcoin
@@ -685,7 +687,11 @@
r.derive = function(i){
i = (i)?i:0;
- var blob = (Crypto.util.hexToBytes(this.keys.pubkey)).concat(coinjs.numToBytes(i,4).reverse());
+ if ((i >= 0x80000000) && (coinjs.hd_derivation == "bip32_derivation")) {
+ var blob = (Crypto.util.hexToBytes("00").concat(Crypto.util.hexToBytes(this.keys.privkey)).concat(coinjs.numToBytes(i,4).reverse()));
+ } else {
+ var blob = (Crypto.util.hexToBytes(this.keys.pubkey)).concat(coinjs.numToBytes(i,4).reverse());
+ }
var j = new jsSHA(Crypto.util.bytesToHex(blob), 'HEX');
var hash = j.getHMAC(Crypto.util.bytesToHex(r.chain_code), "HEX", "SHA-512", "HEX");
diff --git a/js/coinbin.js b/js/coinbin.js
index afc98f17..1a3cccba 100644
--- a/js/coinbin.js
+++ b/js/coinbin.js
@@ -1701,15 +1701,23 @@ $(document).ready(function() {
function deriveHDaddress() {
var hd = coinjs.hd($("#verifyHDaddress .hdKey").html());
- var index_start = $("#verifyHDaddress .derivation_index_start").val()*1;
- var index_end = $("#verifyHDaddress .derivation_index_end").val()*1;
+ var index_start = $("#verifyHDaddress .derivation_index_start").val();
+ if ((index_start.length > 1) && (index_start[index_start.length - 1] == '\'')) {
+ var use_private_index = '\'';
+ index_start = index_start.replace(/[']/, "") * 1;
+ } else {
+ var use_private_index = '';
+ index_start = index_start.replace(/[']/, "") * 1;
+ }
+ var index_end = $("#verifyHDaddress .derivation_index_end").val().replace(/[']/, "") * 1;
+ $("#verifyHDaddress .derivation_index_end").val(index_end + use_private_index);
var html = '';
$("#verifyHDaddress .derived_data table tbody").html("");
for(var i=index_start;i<=index_end;i++){
if($("#hdpathtype option:selected").val()=='simple'){
var derived = hd.derive(i);
} else {
- var derived = hd.derive_path(($("#hdpath input").val().replace(/\/+$/, ""))+'/'+i);
+ var derived = hd.derive_path(($("#hdpath input").val().replace(/\/+$/, ""))+'/'+i+use_private_index);
}
html += '