ethereumjs-util
Advanced tools
Comparing version
@@ -54,2 +54,3 @@ const SHA3 = require('sha3') | ||
* Trims leading zeros from a buffer or an array | ||
* | ||
* @method unpad | ||
@@ -72,3 +73,7 @@ * @param {Buffer|Array|String} | ||
if (typeof v === 'string') { | ||
v = new Buffer(padToEven(exports.stripHexPrefix(v)), 'hex') | ||
if (exports.isHexPrefixed(v)) { | ||
v = new Buffer(padToEven(exports.stripHexPrefix(v)), 'hex') | ||
} else { | ||
v = new Buffer(v) | ||
} | ||
} else if (typeof v === 'number') { | ||
@@ -75,0 +80,0 @@ v = exports.intToBuffer(v) |
{ | ||
"name": "ethereumjs-util", | ||
"version": "1.5.1", | ||
"version": "2.0.0", | ||
"description": "a collection of utility functions for Ethereum", | ||
@@ -28,3 +28,3 @@ "main": "index.js", | ||
"elliptic": "^5.0.0", | ||
"rlp": "^1.1.0", | ||
"rlp": "^1.1.2", | ||
"sha3": "^1.1.0" | ||
@@ -48,4 +48,4 @@ }, | ||
"mocha": "^2.1.0", | ||
"standard": "^5.2.2" | ||
"standard": "^5.3.1" | ||
} | ||
} |
@@ -27,3 +27,3 @@ var assert = require('assert') | ||
var hash = ethUtils.sha3(msg) | ||
assert.equal(hash.toString('hex'), r) | ||
assert.notEqual(hash.toString('hex'), r) | ||
}) | ||
@@ -123,3 +123,3 @@ }) | ||
var add = ethUtils.generateAddress('990ccf8a0de58091c028d6ff76bb235ee67c1c39', 14).toString('hex') | ||
assert.equal(add.toString('hex'), 'd658a4b8247c14868f3c512fa5cbb6e458e4a989') | ||
assert.notEqual(add.toString('hex'), 'd658a4b8247c14868f3c512fa5cbb6e458e4a989') | ||
}) | ||
@@ -126,0 +126,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
57141
7.92%487
1.04%Updated