Class BCrypt

java.lang.Object
org.miaixz.bus.crypto.center.BCrypt

public class BCrypt extends Object
BCrypt加密算法实现。由它加密的文件可在所有支持的操作系统和处理器上进行转移。它的口令必须是8至56个字符,并将在内部被转化为448位的密钥。

此类来自于https://github.com/jeremyh/jBCrypt

使用方法如下: String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt()); 使用checkpw方法检查被加密的字符串是否与原始字符串匹配: BCrypt.checkpw(candidate_password, stored_hash);

gensalt方法提供了可选参数 (log_rounds) 来定义加盐多少,也决定了加密的复杂度: String strong_salt = BCrypt.gensalt(10); String stronger_salt = BCrypt.gensalt(12);

Since:
Java 17+
Author:
Kimi Liu