Java rypt加密是一种基于密码的密钥派生函数,它使用慢哈希函数来抵御攻击。它通过计算一个密码的哈希值,从而创建一个可以用来存储在数据库中的安全密码。
Java rypt加密是一种基于密码的密钥派生函数,它使用慢哈希函数来抵御攻击。它通过计算一个密码的哈希值,从而创建一个可以用来存储在数据库中的安全密码。
下面是一个使用Java rypt加密的示例代码:
// Generate a random salt
String salt = BCrypt.gensalt();
// Hash a pword for the first time
String hashed = BCrypt.hashpw(pword, salt);
// Check that an unencrypted pword matches one that has previously been hashed
if (BCrypt.checkpw(candidate, hashed))
System.out.println("It matches");
else
System.out.println("It does not match");
本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处
评论列表(85条)