Browse Source

hdkey: removed superfluous code with this._privateKeyBigInteger

master
JP Richardson 10 years ago
parent
commit
3ff4b9a068
  1. 4
      CHANGELOG.md
  2. 5
      lib/hdkey.js

4
CHANGELOG.md

@ -1,3 +1,7 @@
0.3.1 / 2014-07-11
------------------
- removed superfluous code `this._privateKeyBigInteger`
0.3.0 / 2014-06-29
------------------
- bugfix: if private key was less than 32 bytes, pad out to 32 bytes with leading zeros (this happens in derive)

5
lib/hdkey.js

@ -22,7 +22,6 @@ function HDKey(versions) {
this.depth = 0
this.index = 0
this._privateKey = null
this._privateKeyInteger = BigInteger.ZERO
this._publicKey = null
this.chainCode = null
this._fingerprint = 0
@ -40,8 +39,7 @@ Object.defineProperty(HDKey.prototype, 'privateKey', {
set: function(value) {
assert.equal(value.length, 32, 'Private key must be 32 bytes.')
this._privateKey = value
this._privateKeyInteger = BigInteger.fromBuffer(this._privateKey)
this._publicPoint = curve.G.multiply(this._privateKeyInteger)
this._publicPoint = curve.G.multiply(BigInteger.fromBuffer(this._privateKey))
this._publicKey = this._publicPoint.getEncoded(true) //force compressed point
this._identifier = hash160(this.publicKey)
this._fingerprint = this._identifier.slice(0, 4).readUInt32BE(0)
@ -59,7 +57,6 @@ Object.defineProperty(HDKey.prototype, 'publicKey', {
this._identifier = hash160(this.publicKey)
this._fingerprint = this._identifier.slice(0, 4).readUInt32BE(0)
this._privateKey = null
this._privateKeyInteger = null
}
})

Loading…
Cancel
Save