Skip to content
This repository was archived by the owner on Jun 17, 2021. It is now read-only.

Commit 75f5294

Browse files
committed
Use keccak instead keccakjs
1 parent a32309d commit 75f5294

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const SHA3 = require('keccakjs')
1+
const createKeccakHash = require('keccak')
22
const secp256k1 = require('secp256k1')
33
const assert = require('assert')
44
const rlp = require('rlp')
@@ -235,11 +235,7 @@ exports.sha3 = function (a, bits) {
235235
a = exports.toBuffer(a)
236236
if (!bits) bits = 256
237237

238-
var h = new SHA3(bits)
239-
if (a) {
240-
h.update(a)
241-
}
242-
return Buffer.from(h.digest('hex'), 'hex')
238+
return createKeccakHash('keccak' + bits).update(a).digest()
243239
}
244240

245241
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"dependencies": {
101101
"bn.js": "^4.8.0",
102102
"create-hash": "^1.1.2",
103-
"keccakjs": "^0.2.0",
103+
"keccak": "^1.0.2",
104104
"rlp": "^2.0.0",
105105
"secp256k1": "^3.0.1"
106106
},

0 commit comments

Comments
 (0)