Created
August 31, 2019 06:50
-
-
Save ranisalt/d88b1b3d623c4dce6fbbdce08bbdb0c6 to your computer and use it in GitHub Desktop.
node-argon2 benchmarks
This file contains hidden or 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 { Suite } = require('sandra') | |
const argon2 = require('../argon2') | |
const main = async () => { | |
const defaults = argon2.defaults | |
const password = 'password' | |
const hash = await argon2.hash(password) | |
const suite = new Suite('argon2') | |
suite.push('basic hash', argon2.hash, password) | |
suite.push('interactive hash', argon2.hash, password, { memoryCost: 2 ** 15, timeCost: 4 }) | |
suite.push('moderate hash', argon2.hash, password, { memoryCost: 2 ** 17, timeCost: 6 }) | |
suite.push('sensitive hash', argon2.hash, password, { memoryCost: 2 ** 19, timeCost: 8 }) | |
suite.push('basic raw hash', argon2.hash, password, { raw: true }) | |
suite.push('time cost', argon2.hash, password, { timeCost: defaults.timeCost + 1 }) | |
suite.push('memory cost', argon2.hash, password, { memoryCost: defaults.memoryCost * 2 }) | |
suite.push('parallelism', argon2.hash, password, { parallelism: defaults.parallelism + 1 }) | |
suite.push('argon2d', argon2.hash, password, { type: argon2.argon2d }) | |
suite.push('argon2d raw hash', argon2.hash, password, { type: argon2.argon2d, raw: true }) | |
suite.push('argon2id', argon2.hash, password, { type: argon2.argon2id }) | |
suite.push('argon2id raw hash', argon2.hash, password, { type: argon2.argon2id, raw: true }) | |
suite.push('verify', argon2.verify, hash, password) | |
suite.on('cycle', event => { | |
console.log(event.toString()) | |
}) | |
await suite.run({ | |
timeout: 2500 | |
}) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment