I have used the PHP crypt function to hash password. For example:
<?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";
NOW:
If i use php bcrypt password_hash()
function i get this following output:
Password: test
bcrypted password using password_hash()
is :
$2y$08$ffWmSGZOM5pNJpHNvpqMa.z01BL25WGoXViaWYhxS0WRaftgAxhkC
Now I want to have the same output in Android Java. My questions are:
- How can I achieve this?
- Is there any class file or default function in android java so that I can use to achieve this?
- Do I have to write a custom function to achieve this?
I also want to decrypt the password using java.
Any answer with an example will be appreciated. Advance thanks to all.