Browse Source

lib: dropped sha512 dep in favor of latest crypto-browserify with sha512 support

master
JP Richardson 10 years ago
parent
commit
0c53b8339f
  1. 4
      CHANGELOG.md
  2. 6
      lib/hdkey.js
  3. 8
      package.json

4
CHANGELOG.md

@ -1,3 +1,7 @@
0.4.0 / 2014-09-24
------------------
- dropped `sha512` dependency and upgraded to crypto-browserify that supports sha512
0.3.1 / 2014-07-11
------------------
- removed superfluous code `this._privateKeyBigInteger`

6
lib/hdkey.js

@ -5,8 +5,6 @@ var cs = require('coinstring')
var ecurve = require('ecurve')
var curve = ecurve.getCurveByName('secp256k1')
var Point = ecurve.Point
var sha512 = require('sha512')
module.exports = HDKey
@ -118,7 +116,7 @@ HDKey.prototype.deriveChild = function(index) {
data = Buffer.concat([this.publicKey, indexBuffer])
}
var I = sha512.hmac(this.chainCode).finalize(data)
var I = crypto.createHmac('sha512', this.chainCode).update(data).digest()
var IL = I.slice(0, 32)
var IR = I.slice(32)
@ -161,7 +159,7 @@ HDKey.prototype.deriveChild = function(index) {
}
HDKey.fromMasterSeed = function(seedBuffer, versions) {
var I = sha512.hmac(MASTER_SECRET).finalize(seedBuffer)
var I = crypto.createHmac('sha512', MASTER_SECRET).update(seedBuffer).digest()
var IL = I.slice(0, 32)
var IR = I.slice(32)

8
package.json

@ -26,11 +26,10 @@
"mocha-lcov-reporter": "0.0.1",
"istanbul": "^0.2.10",
"secure-random": "^1.0.0",
"mochify": "^0.9.3",
"crypto-browserify": "^2.1.8"
"mochify": "^1.1.2",
"crypto-browserify": "^3.2.4"
},
"dependencies": {
"sha512": "0.0.1",
"bigi": "^1.1.0",
"ecurve": "^1.0.0",
"coinstring": "^2.0.0"
@ -39,8 +38,5 @@
"unit": "./node_modules/.bin/mocha",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",
"coveralls": "npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info"
},
"browser": {
"crypto": "crypto-browserify"
}
}

Loading…
Cancel
Save