首页 > bcrypt加密密码计算强度代表什么意思

bcrypt加密密码计算强度代表什么意思

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,


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

小于4轮是不好使的会默认变成10轮

【热门文章】
【热门文章】