Skip to content

Instantly share code, notes, and snippets.

@ccnokes
Created October 28, 2016 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccnokes/08e58e012d196a2f4d45e0dfb3074763 to your computer and use it in GitHub Desktop.
Save ccnokes/08e58e012d196a2f4d45e0dfb3074763 to your computer and use it in GitHub Desktop.
const crypto = require('crypto');
// this usually takes a few seconds
function work(limit = 100000) {
let start = Date.now();
n = 0;
while(n < limit) {
crypto.randomBytes(2048);
n++;
}
return {
timeElapsed: Date.now() - start,
};
}
module.exports = work;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment