Skip to content

Commit

Permalink
Merge pull request #357 from MicahZoltu/js-sha3
Browse files Browse the repository at this point in the history
Removes ethereumjs-util and keccak dependencies.
  • Loading branch information
axic committed Jul 4, 2019
2 parents ea40b79 + f441441 commit bedf80d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions downloadCurrentVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var pkg = require('./package.json');
var fs = require('fs');
var https = require('https');
var MemoryStream = require('memorystream');
var ethJSUtil = require('ethereumjs-util');
var keccak256 = require('js-sha3').keccak256;

function getVersionList (cb) {
console.log('Retrieving available version list...');
Expand Down Expand Up @@ -48,7 +48,7 @@ function downloadBinary (outputName, version, expectedHash) {
response.pipe(file);
file.on('finish', function () {
file.close(function () {
var hash = '0x' + ethJSUtil.sha3(fs.readFileSync(outputName, { encoding: 'binary' })).toString('hex');
var hash = '0x' + keccak256(fs.readFileSync(outputName, { encoding: 'binary' }));
if (expectedHash !== hash) {
console.log('Hash mismatch: ' + expectedHash + ' vs ' + hash);
process.exit(1);
Expand Down
8 changes: 2 additions & 6 deletions linker.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
var keccak = require('keccak');

function keccak256 (input) {
return keccak('keccak256').update(input).digest();
}
var keccak256 = require('js-sha3').keccak256;

function libraryHashPlaceholder (input) {
return '$' + keccak256(input).toString('hex').slice(0, 34) + '$';
return '$' + keccak256(input).slice(0, 34) + '$';
}

var linkBytecode = function (bytecode, libraries) {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@
"dependencies": {
"command-exists": "^1.2.8",
"fs-extra": "^0.30.0",
"keccak": "^1.0.2",
"memorystream": "^0.3.1",
"require-from-string": "^2.0.0",
"semver": "^5.5.0",
"js-sha3": "0.8.0",
"tmp": "0.0.33",
"yargs": "^11.0.0"
},
"devDependencies": {
"coveralls": "^3.0.0",
"ethereumjs-util": "^5.2.0",
"istanbul": "^0.4.5",
"semistandard": "^12.0.0",
"tape": "=4.9.2",
Expand Down

0 comments on commit bedf80d

Please sign in to comment.