So I have created a website in PHP which includes a blog. The website has an account system, and I am now trying to create a desktop application in java which will allow me to login and post into the blog.
The problem I have is with the encryption. The website uses a whirlpool hash and encryption, and I can't figure out how to duplicate the same in java. I have found a code on the internet which seems to have the functionality of creating the whirlpool hash, but I don't know which method to use to actually send it the password string and get back the hash.
Here is the PHP code that runs on my website:
return substr( str_pad( dechex( mt_rand() ), 8, '0', STR_PAD_LEFT ), -8 );
function getPasswordHash( $salt, $password )
return $salt . ( hash( 'whirlpool', $salt . $password ) );
function comparePassword( $password, $hash )
$salt = substr( $hash, 0, 8 );
return $hash == $this->getPasswordHash( $salt, $password );
The above functions are used in the following manner:
getPasswordHash( $this->getPasswordSalt (), $password );
And here is a link to the java code that I found:
If anyone has any suggestions to solve the problem it'd be greatly appreciated!