multihashing-async
Advanced tools
Comparing version
@@ -30,3 +30,3 @@ 'use strict' | ||
suite.add(alg, function (d) { | ||
const buf = new Buffer(10 * 1024) | ||
const buf = Buffer.alloc(10 * 1024) | ||
buf.fill(Math.ceil(Math.random() * 100)) | ||
@@ -44,9 +44,9 @@ | ||
suite | ||
.on('cycle', (event) => { | ||
console.log(String(event.target)) | ||
list = [] | ||
}) | ||
// run async | ||
.run({ | ||
async: true | ||
}) | ||
.on('cycle', (event) => { | ||
console.log(String(event.target)) | ||
list = [] | ||
}) | ||
// run async | ||
.run({ | ||
async: true | ||
}) |
@@ -0,1 +1,11 @@ | ||
<a name="0.4.8"></a> | ||
## [0.4.8](https://github.com/multiformats/js-multihashing-async/compare/v0.4.7...v0.4.8) (2018-02-27) | ||
### Features | ||
* add double SHA2-256 hashing ([cb3779d](https://github.com/multiformats/js-multihashing-async/commit/cb3779d)), closes [#25](https://github.com/multiformats/js-multihashing-async/issues/25) | ||
<a name="0.4.7"></a> | ||
@@ -2,0 +12,0 @@ ## [0.4.7](https://github.com/multiformats/js-multihashing-async/compare/v0.4.6...v0.4.7) (2017-10-20) |
'use strict' | ||
const multihashing = require('multihashing-async') | ||
const buf = new Buffer('beep boop') | ||
const buf = Buffer.from('beep boop') | ||
@@ -6,0 +6,0 @@ function print (err, mh) { |
{ | ||
"name": "multihashing-async", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"description": "multiple hash functions", | ||
@@ -10,13 +10,13 @@ "main": "src/index.js", | ||
"scripts": { | ||
"test": "aegir-test", | ||
"test:browser": "aegir-test browser", | ||
"test:node": "aegir-test node", | ||
"lint": "aegir-lint", | ||
"docs": "aegir-docs", | ||
"release": "aegir-release --docs", | ||
"release-minor": "aegir-release minor --docs", | ||
"release-major": "aegir-release major --docs", | ||
"build": "aegir-build", | ||
"coverage": "aegir-coverage", | ||
"coverage-publish": "aegir-coverage publish", | ||
"test": "aegir test", | ||
"test:browser": "aegir test -t browser", | ||
"test:node": "aegir test -t node", | ||
"lint": "aegir lint", | ||
"docs": "aegir docs", | ||
"release": "aegir release --docs", | ||
"release-minor": "aegir release minor --docs", | ||
"release-major": "aegir release major --docs", | ||
"build": "aegir build", | ||
"coverage": "aegir coverage", | ||
"coverage-publish": "aegir coverage publish", | ||
"bench": "node benchmarks/hash.js" | ||
@@ -41,6 +41,6 @@ }, | ||
"dependencies": { | ||
"async": "^2.5.0", | ||
"async": "^2.6.0", | ||
"blakejs": "^1.1.0", | ||
"js-sha3": "^0.6.1", | ||
"multihashes": "~0.4.12", | ||
"js-sha3": "^0.7.0", | ||
"multihashes": "~0.4.13", | ||
"murmurhash3js": "^3.0.1", | ||
@@ -50,3 +50,3 @@ "nodeify": "^1.0.1" | ||
"devDependencies": { | ||
"aegir": "^11.0.2", | ||
"aegir": "^13.0.5", | ||
"benchmark": "^2.1.4", | ||
@@ -58,3 +58,3 @@ "chai": "^4.1.2", | ||
"engines": { | ||
"node": ">=4.0.0", | ||
"node": ">=6.0.0", | ||
"npm": ">=3.0.0" | ||
@@ -73,4 +73,6 @@ }, | ||
"Richard Littauer <richard.littauer@gmail.com>", | ||
"Victor Bjelkholm <victorbjelkholm@gmail.com>", | ||
"Volker Mische <volker.mische@gmail.com>", | ||
"npm-to-cdn-bot (by Forbes Lindesay) <npmcdn-to-unpkg-bot@users.noreply.github.com>" | ||
] | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
/* global self */ | ||
'use strict' | ||
@@ -27,3 +29,3 @@ | ||
res.onerror = () => { | ||
callback(`Error hashing data using ${type}`) | ||
callback(new Error(`hashing data using ${type}`)) | ||
} | ||
@@ -37,3 +39,3 @@ res.oncomplete = (e) => { | ||
nodeify( | ||
res.then((raw) => new Buffer(new Uint8Array(raw))), | ||
res.then((raw) => Buffer.from(new Uint8Array(raw))), | ||
callback | ||
@@ -40,0 +42,0 @@ ) |
@@ -14,2 +14,11 @@ 'use strict' | ||
const dblSha2256 = (buf, cb) => { | ||
sha.sha2256(buf, (err, firstHash) => { | ||
if (err) { | ||
cb(err) | ||
} | ||
sha.sha2256((Buffer.from(firstHash)), cb) | ||
}) | ||
} | ||
module.exports = { | ||
@@ -31,3 +40,4 @@ sha1: sha.sha1, | ||
murmur332: toCallback(fromNumberTo32BitBuf(fromString(murmur3.x86.hash32))), | ||
addBlake: require('./blake') | ||
addBlake: require('./blake'), | ||
dblSha2256: dblSha2256 | ||
} |
@@ -135,3 +135,5 @@ 'use strict' | ||
// murmur3-32 | ||
0x23: crypto.murmur332 | ||
0x23: crypto.murmur332, | ||
// dbl-sha2-256 | ||
0x56: crypto.dblSha2256 | ||
} | ||
@@ -138,0 +140,0 @@ |
@@ -25,3 +25,3 @@ 'use strict' | ||
let result = doWork(input, other) | ||
return new Buffer(result, 'hex') | ||
return Buffer.from(result, 'hex') | ||
} | ||
@@ -28,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
527383
2.33%19
11.76%6102
-4.64%+ Added
- Removed
Updated
Updated
Updated