node.js - bcrypt加密密码计算强度代表什么意思
ringa_lee
ringa_lee 2017-04-17 11:53:12
0
1
599

nodejs 中Bcrypt 在计算salt值时,计算强度为什么1-3 是一个阶段,4-10 是另外一个阶段。

var bcrypt = require('bcrypt-nodejs');

for (k=0;k<11;k++){

    timeout(k);
}

function timeout(round){
    console.log("round:"+round);
    var start = new Date();
    for(i=0;i<10;i++){
        var salt = bcrypt.genSaltSync(round);   
        var hash = bcrypt.hashSync('gebilaowang',salt);
        // console.log(hash);
    }

    var end = new Date();

    console.log(end-start+'ms');
}

1-3 的计算时间是1067ms ,和为10的值几本一样,但是4 才50ms,之后每次多一点一直到10,

ringa_lee
ringa_lee

ringa_lee

reply all(1)
阿神

https://github.com/shaneGirish/bcrypt-nodejs/blob/master/bCrypt.js#L54...

It won’t work if it’s less than 4 rounds, it will default to 10 rounds

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template