2017-06-18 38 views

回答

2

你可以看看这个:

https://github.com/ircmaxell/password_compat/issues/49

这对我的工作:

public static void main(String[] args) { 
    //Laravel bcrypt out 
    String hash_php = "$2y$10$ss9kwE8iSIqcJOAPhZR0Y.2XdYXJTFJ1/wGq6SUv74vULE7uhKUIO".replaceFirst("2y", "2a"); 
    System.out.println("hash php " + hash_php); 
    //String a_hash = BCrypt.hashpw("123456", BCrypt.gensalt()); 
    //System.out.println("Encrypt " + a_hash); 
    if (BCrypt.checkpw("123456", hash_php)) { 
     System.out.println("It matches"); 
    } else { 
     System.out.println("It does not match"); 
    } 
    //mtPruebaRecuperarClave(); 

} 

控制台 - 输出

[1]

我希望我们帮助你。

+0

它为我工作!非常感谢@cristianippolito – Brigadier