diff --git a/index.html b/index.html index efa7018..c229fa4 100644 --- a/index.html +++ b/index.html @@ -384,7 +384,7 @@

Address Options

-

You can use the advanced options below to generate different kind of master address.

+

You can use the advanced options below to generate different kinds of master addresses.

diff --git a/js/coin.js b/js/coin.js index 73e108d..8f8b98b 100644 --- a/js/coin.js +++ b/js/coin.js @@ -439,6 +439,7 @@ } } + // extend prv/pub key r.extend = function(){ var hd = coinjs.hd(); return hd.make({'depth':(this.depth*1)+1, @@ -449,8 +450,9 @@ 'pubkey':this.keys.pubkey}); } + // derive key from index r.derive = function(i){ - i = (i)?i:0; + i = (i)?:0; var blob = (Crypto.util.hexToBytes(this.keys.pubkey)).concat(coinjs.numToBytes(i,4).reverse()); var j = new jsSHA(Crypto.util.bytesToHex(blob), 'HEX'); @@ -469,6 +471,7 @@ o.child_index = i; if(this.type=='private'){ + // derive xpub/xprv from a xprv key k = il.add(new BigInteger([0].concat(Crypto.util.hexToBytes(this.keys.privkey)))).mod(ecparams.getN()); key = Crypto.util.bytesToHex(k.toByteArrayUnsigned()); @@ -480,6 +483,7 @@ 'address':coinjs.pubkey2address(pubkey)}; } else if (this.type=='public'){ + // derive xpub key from an xpub key q = ecparams.curve.decodePointHex(this.keys.pubkey); var curvePt = ecparams.getG().multiply(il).add(q); @@ -535,12 +539,12 @@ //child index k = k.concat((coinjs.numToBytes(data.child_index, 4)).reverse()); - // Chain code + //Chain code k = k.concat(data.chain_code); var o = {}; // results - // Extended HD Private Key + //encode xprv key if(data.privkey){ var prv = (coinjs.numToBytes(coinjs.hdkey.prv, 4)).reverse(); prv = prv.concat(k); @@ -552,7 +556,7 @@ o.privkey = coinjs.base58encode(ret); } - // Extended HD Public Key + //encode xpub key if(data.pubkey){ var pub = (coinjs.numToBytes(coinjs.hdkey.pub, 4)).reverse(); pub = pub.concat(k); diff --git a/sha1sum b/sha1sum index 632e068..01cfe05 100644 --- a/sha1sum +++ b/sha1sum @@ -10,7 +10,7 @@ f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js ad038e1f39646b68ae666324ed4c2882a8c42474 ./js/qrcode.js 64eb4ea5c882f8bce3e1885bf00728455f1c2f4c ./js/ripemd160.js 114089ef2a3feb6d4db4f9cabcb186d7750d5884 ./js/sha512.js -b7d72e6064cf8a1a0b5a602bc2a976ce3d61aadf ./js/coin.js +6db735d6bc9fbacd7a874ad3c4dee92b6f8d95ce ./js/coin.js 8e921b2156d232871540e168e1677368b5611dc9 ./js/coinbin.js ae49e56999d82802727455f0ba83b63acd90a22b ./js/jquery-1.9.1.min.js 5f570018ed044eafd464f7e0ab1783b966224055 ./LICENCE @@ -25,4 +25,4 @@ de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.s 278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff 44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf fe8d57914bb036ab94e86ec35b2671eeb6d20d0d ./README.md -44ab99a496aab01d8181e0f2ac9b02ad8b854d9d ./index.html +954c6edeac5881c4e12b3db46875a6eab18239b8 ./index.html