I am using this http://raginggoblin.wordpress.com/2012/08/11/java-alternative-to-php-crypt-function/ for the equivalent of php crypt function or does it says here that it is...
But I have the same value in java and in php but the hashing result is different.. I was wondering if not hashing is different because its not executed the same way ? I post this two values to a WS.
JAVA:
String doc_data="{\"table\":\"1048582\"}";
String data="$5$rounds=5000$503$La071hYxZERff9GGq0cb.x2k96Xx25\/C4vxQztQ7B96";
String result=Crypt.crypt(doc_data, data);
PHP:
$params['result'] = crypt($params['doc_data'], @$this->initdata['data']);
I logged it and I put the exact data in from POST... but the result is not the same.. There is no way to do this right ? or there is no equivalent?
Before that library I used Guava..but still not the same
public static String crypt_sha256(String password, String salt) {
int iteration_count = 5000;
HashFunction func = Hashing.sha256();
HashCode result = func.hashString(salt + param1, Charsets.UTF_8);
for (int i = 0; i < iteration_count; i++) {
result = func.hashBytes(result.asBytes());
}
return salt + result.toString();
}