Created
February 25, 2018 16:40
-
-
Save scottopell/e6aaaea5835a01fab1e63fe4a56898d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Benchmark = require('benchmark'); | |
var suite = new Benchmark.Suite; | |
var createHash = require('crypto').createHash; | |
suite.add('md2', () => { | |
createHash('md2').update('HELLO WORLD').digest('hex'); | |
}) | |
.add('md4', () => { | |
createHash('md4').update('HELLO WORLD').digest('hex'); | |
}) | |
.add('md5', () => { | |
createHash('md5').update('HELLO WORLD').digest('hex'); | |
}) | |
.add('mdc2', () => { | |
createHash('mdc2').update('HELLO WORLD').digest('hex'); | |
}) | |
.add('rmd160', () => { | |
createHash('rmd160').update('HELLO WORLD').digest('hex'); | |
}) | |
.add('sha', () => { | |
createHash('sha').update('HELLO WORLD').digest('hex'); | |
}) | |
.add('sha1', () => { | |
createHash('sha1').update('HELLO WORLD').digest('hex'); | |
}) | |
.on('cycle', function(event) { | |
console.log(String(event.target)); | |
}) | |
.on('complete', function() { | |
console.log('Fastest is ' + this.filter('fastest').map('name')); | |
}) | |
.run({ 'async': true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment