Skip to content

Instantly share code, notes, and snippets.

@sytranvn
Created April 3, 2020 05:48
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 sytranvn/fe011bda3ef3e4315bef5d588b3448f3 to your computer and use it in GitHub Desktop.
Save sytranvn/fe011bda3ef3e4315bef5d588b3448f3 to your computer and use it in GitHub Desktop.
const algorithm = 'aes-192-cbc';
const password = 'Password used to generate key';
const LOOPS = process.env.LOOPS || 2;
// start mesuring time
const hrstart = process.hrtime()
for (i=1; i <= LOOPS; i++) {
const index = i;
const cb = () => {
const hrend = process.hrtime(hrstart);
console.info('Execution time crypto %d (hr): %ds %dms', index, hrend[0], hrend[1] / 1000000);
}
const key = crypto.scrypt(password, 'salt', 24, cb);
}
const pend = process.hrtime(hrstart);
console.info('Process ended in (hr): %ds %dms', pend[0], pend[1] / 1000000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment