2017-06-18 78 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