相关疑难解决方法(0)

我需要用bcrypt储存盐吗?

bCrypt的javadoc有如何加密密码的代码:

String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt()); 
Run Code Online (Sandbox Code Playgroud)

要检查明文密码是否与先前已经散列的密码匹配,请使用checkpw方法:

if (BCrypt.checkpw(candidate_password, stored_hash))
    System.out.println("It matches");
else
    System.out.println("It does not match");
Run Code Online (Sandbox Code Playgroud)

这些代码片段向我暗示随机生成的盐被丢弃.是这种情况,还是只是一个误导性的代码片段?

java encryption passwords salt bcrypt

186
推荐指数
1
解决办法
3万
查看次数

标签 统计

bcrypt ×1

encryption ×1

java ×1

passwords ×1

salt ×1