Guest User

Untitled

a guest
Aug 14th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public static void main(String[] args) {
  2. //Laravel bcrypt out
  3. String hash_php = "$2y$10$ss9kwE8iSIqcJOAPhZR0Y.2XdYXJTFJ1/wGq6SUv74vULE7uhKUIO".replaceFirst("2y", "2a");
  4. System.out.println("hash php " + hash_php);
  5. //String a_hash = BCrypt.hashpw("123456", BCrypt.gensalt());
  6. //System.out.println("Encrypt " + a_hash);
  7. if (BCrypt.checkpw("123456", hash_php)) {
  8. System.out.println("It matches");
  9. } else {
  10. System.out.println("It does not match");
  11. }
  12. //mtPruebaRecuperarClave();
  13.  
  14. }
  15.  
  16. $2y$10$ss9kwE8iSIqcJOAPhZR0Y.2XdYXJTFJ1/wGq6SUv74vULE7uhKUIO
  17.  
  18. $2a$10$ss9kwE8iSIqcJOAPhZR0Y.2XdYXJTFJ1/wGq6SUv74vULE7uhKUIO
  19.  
  20. String hash_php = "$2y$10$ss9kwE8iSIqcJOAPhZR0Y.2XdYXJTFJ1/wGq6SUv74vULE7uhKUIO".replaceFirst("$2y$", "$2a$");
  21.  
  22. BCrypt.Result result = BCrypt.verifyer().verify(password.toCharArray(), "$2y$10$ss9kwE8iSIqcJOAPhZR0Y.2XdYXJTFJ1/wGq6SUv74vULE7uhKUIO")
  23. if(result.verified) {...}
  24.  
  25. String bcryptHash = BCrypt.with(BCrypt.Version.VERSION_2Y).hashToString(6, password.toCharArray());
  26. // $2y$10$ss9kwE8iSIqcJOAPhZR0Y.2XdYXJTFJ1/wGq6SUv74vULE7uhKUIO
Add Comment
Please, Sign In to add comment