ecdsa/HDNode: use node crypto for Hmacs
This commit is contained in:
parent
f3ddc508f1
commit
7ef134436e
2 changed files with 30 additions and 12 deletions
src
|
@ -1,6 +1,7 @@
|
|||
var assert = require('assert')
|
||||
var base58check = require('bs58check')
|
||||
var crypto = require('./crypto')
|
||||
var bcrypto = require('./crypto')
|
||||
var crypto = require('crypto')
|
||||
var enforceType = require('./types')
|
||||
var networks = require('./networks')
|
||||
|
||||
|
@ -56,7 +57,7 @@ HDNode.fromSeedBuffer = function(seed, network) {
|
|||
assert(seed.length >= 16, 'Seed should be at least 128 bits')
|
||||
assert(seed.length <= 64, 'Seed should be at most 512 bits')
|
||||
|
||||
var I = crypto.HmacSHA512(seed, HDNode.MASTER_SECRET)
|
||||
var I = crypto.createHmac('sha512', HDNode.MASTER_SECRET).update(seed).digest()
|
||||
var IL = I.slice(0, 32)
|
||||
var IR = I.slice(32)
|
||||
|
||||
|
@ -145,7 +146,7 @@ HDNode.fromHex = function(hex, network) {
|
|||
}
|
||||
|
||||
HDNode.prototype.getIdentifier = function() {
|
||||
return crypto.hash160(this.pubKey.toBuffer())
|
||||
return bcrypto.hash160(this.pubKey.toBuffer())
|
||||
}
|
||||
|
||||
HDNode.prototype.getFingerprint = function() {
|
||||
|
@ -255,7 +256,7 @@ HDNode.prototype.derive = function(index) {
|
|||
])
|
||||
}
|
||||
|
||||
var I = crypto.HmacSHA512(data, this.chainCode)
|
||||
var I = crypto.createHmac('sha512', this.chainCode).update(data).digest()
|
||||
var IL = I.slice(0, 32)
|
||||
var IR = I.slice(32)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue