Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hashSync method cost too long time #125

Open
CurrrryChen opened this issue Mar 21, 2021 · 1 comment
Open

hashSync method cost too long time #125

CurrrryChen opened this issue Mar 21, 2021 · 1 comment

Comments

@CurrrryChen
Copy link

code as below:

const bcrypt = require('bcryptjs');

console.time();
const salt = bcrypt.genSaltSync(20);
const hash = bcrypt.hashSync('I love cupcakes', salt);
console.timeEnd();

console.log(hash);

log as below:

default: 1:26.472 (m:ss.mmm)
$2a$20$oO4XV.2/F4sq9LYCtBtedel65ntZLJCYq70PPAZ0bEoNsPo.i.LCa

MacOS: 10.15.7
Node: v14.16.0

Everthing goes well weeks ago,I tried to restart my pc and reinstall node and clear node_modules, nothing changed.

@sashankaryal
Copy link

With 20 salt rounds, I'm not surprised.

rounds=8 : ~40 hashes/sec
rounds=9 : ~20 hashes/sec
rounds=10: ~10 hashes/sec
rounds=11: ~5 hashes/sec
rounds=12: 2-3 hashes/sec
rounds=13: ~1 sec/hash
rounds=14: ~1.5 sec/hash
rounds=15: ~3 sec/hash
rounds=25: ~1 hour/hash
rounds=31: 2-3 days/hash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants