kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.49k stars 518 forks source link

Minimum salt is 4? #870

Closed tugrul512bit closed 3 years ago

tugrul512bit commented 3 years ago

I'm using genSalt method for protecting a custom captcha. It does not reduce the cost to 1,2,3 when I'm assigning 1,2,3 to the cost parameter.

    bcrypt.genSalt(1, function(err, salt) {
        bcrypt.hash(text, salt, function(err, hash) {
        callback(hash);
        });
    });

but it produces this:

$2b$04$zJw1mfUKJ2/su4oFh1SDtuA7Plg5jzHPy3yx9JeXeGFTc6hfgMZuK

This means, $04$ = 4 salts right? I just needed a 60-second protection against 8-GPU Nvidia crackers or whatever brute-force attacks, with minimum compute time on server (currently with 4 salts, my home computer creates 350 captchas per second, with the highest bottleneck on bcrypt's latency that is 2x-3x of mongodb upsert operation).

recrsn commented 3 years ago

Yes the minimum salt is 4