|
|
@@ -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) {
|