Skip to content

Instantly share code, notes, and snippets.

@jbarguil
Created August 24, 2021 03:57
Show Gist options
  • Save jbarguil/01ebd435ea7f727dac0a19ded20ddc60 to your computer and use it in GitHub Desktop.
Save jbarguil/01ebd435ea7f727dac0a19ded20ddc60 to your computer and use it in GitHub Desktop.
const crypto = require("crypto");
getHash = (content) => crypto.createHash("sha256")
.update(content)
.digest("hex");
var start = Date.now();
// A million hashes take ~3000ms on my Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz.
// You might want to increase this value.
for (var i = 0; i < 1000000; i++)
getHash("Yeah, Well, That's Just, Like, Your Opinion, Man.");
console.log(Date.now() - start);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment