Upgrade to ethereumjs-util 6.0.0

This commit is contained in:
Alex Beregszaszi 2018-12-19 00:08:03 +00:00
parent 93b0fae5f9
commit a0ab9292dc
3 changed files with 7 additions and 7 deletions

View File

@ -34,7 +34,7 @@
"dependencies": {
"aes-js": "^3.1.1",
"bs58check": "^2.1.2",
"ethereumjs-util": "^5.2.0",
"ethereumjs-util": "^6.0.0",
"hdkey": "^1.1.0",
"randombytes": "^2.0.6",
"safe-buffer": "^5.1.2",

View File

@ -142,7 +142,7 @@ Wallet.prototype.toV3 = function (password, opts) {
var ciphertext = Buffer.concat([ cipher.update(this.privKey), cipher.final() ])
var mac = ethUtil.sha3(Buffer.concat([ derivedKey.slice(16, 32), Buffer.from(ciphertext, 'hex') ]))
var mac = ethUtil.keccak256(Buffer.concat([ derivedKey.slice(16, 32), Buffer.from(ciphertext, 'hex') ]))
return {
version: 3,
@ -230,13 +230,13 @@ Wallet.fromV1 = function (input, password) {
var ciphertext = Buffer.from(json.Crypto.CipherText, 'hex')
var mac = ethUtil.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ]))
var mac = ethUtil.keccak256(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ]))
if (mac.toString('hex') !== json.Crypto.MAC) {
throw new Error('Key derivation failed - possibly wrong passphrase')
}
var decipher = crypto.createDecipheriv('aes-128-cbc', ethUtil.sha3(derivedKey.slice(0, 16)).slice(0, 16), Buffer.from(json.Crypto.IV, 'hex'))
var decipher = crypto.createDecipheriv('aes-128-cbc', ethUtil.keccak256(derivedKey.slice(0, 16)).slice(0, 16), Buffer.from(json.Crypto.IV, 'hex'))
var seed = decipherBuffer(decipher, ciphertext)
return new Wallet(seed)
@ -271,7 +271,7 @@ Wallet.fromV3 = function (input, password, nonStrict) {
var ciphertext = Buffer.from(json.crypto.ciphertext, 'hex')
var mac = ethUtil.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ]))
var mac = ethUtil.keccak256(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ]))
if (mac.toString('hex') !== json.crypto.mac) {
throw new Error('Key derivation failed - possibly wrong passphrase')
}
@ -301,7 +301,7 @@ Wallet.fromEthSale = function (input, password) {
var decipher = crypto.createDecipheriv('aes-128-cbc', derivedKey, encseed.slice(0, 16))
var seed = decipherBuffer(decipher, encseed.slice(16))
var wallet = new Wallet(ethUtil.sha3(seed))
var wallet = new Wallet(ethUtil.keccak256(seed))
if (wallet.getAddress().toString('hex') !== json.ethaddr) {
throw new Error('Decoded key mismatch - possibly wrong passphrase')
}

View File

@ -134,7 +134,7 @@ Thirdparty.fromEtherWallet = function (input, password) {
}
Thirdparty.fromEtherCamp = function (passphrase) {
return new Wallet(ethUtil.sha3(Buffer.from(passphrase)))
return new Wallet(ethUtil.keccak256(Buffer.from(passphrase)))
}
Thirdparty.fromKryptoKit = function (entropy, password) {