mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix check bug
This commit is contained in:
@@ -511,7 +511,14 @@ public class BCrypt {
|
||||
public static boolean checkpw(String plaintext, String hashed) {
|
||||
byte[] hashed_bytes;
|
||||
byte[] try_bytes;
|
||||
String try_pw = hashpw(plaintext, hashed);
|
||||
|
||||
String try_pw;
|
||||
try{
|
||||
try_pw = hashpw(plaintext, hashed);
|
||||
} catch (Exception ignore){
|
||||
// 生成密文时错误直接返回false issue#1377@Github
|
||||
return false;
|
||||
}
|
||||
hashed_bytes = hashed.getBytes(CharsetUtil.CHARSET_UTF_8);
|
||||
try_bytes = try_pw.getBytes(CharsetUtil.CHARSET_UTF_8);
|
||||
if (hashed_bytes.length != try_bytes.length) {
|
||||
|
Reference in New Issue
Block a user