Created
June 18, 2021 16:48
-
-
Save keepitsimple/d36e9c13c6610c0e394303543aa87e1e to your computer and use it in GitHub Desktop.
Node.js fastest hash function
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
const crypto = require('crypto'); | |
console.time('hash') | |
const hash = crypto.createHash('md5').update(str).digest("hex"); | |
console.timeEnd('hash') | |
console.log(hash) | |
// sha1 function is much faster on my computer | |
console.time('hash2') | |
const hash2 = crypto.createHash('sha1').update(str).digest("base64"); | |
console.timeEnd('hash2') | |
console.log(hash2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment