title: How to have the same password compatible with both java and php?
body: <p>I have used the PHP crypt function to hash password.
  For example: </p>
  
  <pre><code>&lt;?php
  
  $hash = '$2y$08$ffWmSGZOM5pNJpHNvpqMa.z01BL25WGoXViaWYhxS0WRaftgAxhkC';
  $test = crypt("test", $hash);
  $pass = $test == $hash;
  
  echo "Test for functionality of compat library: " . ($pass ? "Pass" : "Fail");
  echo "\n";
  </code></pre>
  
  <p>NOW:
  If i use php bcrypt <code>password_hash()</code> function i get this following output:</p>
  
  <p>Password: test</p>
  
  <p>bcrypted password using <code>password_hash()</code> is : 
      $2y$08$ffWmSGZOM5pNJpHNvpqMa.z01BL25WGoXViaWYhxS0WRaftgAxhkC</p>
  
  <p>Now I want to have the same output in Android Java.
  My questions are:</p>
  
  <ol>
  <li>How can I achieve this?</li>
  <li>Is there any class file or default function in android java so that I can use to achieve this?</li>
  <li>Do I have to write a custom function to achieve this?</li>
  </ol>
  
  <p>I also want to decrypt the password using java.</p>
  
  <p>Any answer with an example will be appreciated. Advance thanks to all.</p>