I want to encrypt a String using gnu.crypto.hash.Whirlpool hashing.
The encrypt should encrypt the password and should return the encrypted pwd. encrypt(pwd);
This method should have implementation for encrypting pwd using gnu jars and whirlpool
hashing algorithm which should be equal to the pwd generated by the below site http://hash.online-convert.com/whirlpool-generator
I tried with the code below but I am unable to get the 512 byets code similar to the whirlpool site generated:
import gnu.crypto.hash.HashFactory;
import gnu.crypto.hash.IMessageDigest;
public class EncryptPwdWithAPI{
public static void main(String arg[])
{
encrypt("somepwd");
}
public static String encrypt(String password)
{
IMessageDigest md = HashFactory.getInstance("WHIRLPOOL");
md.update(input, 0, input.length);
byte[] digest = md.digest();
System.out.println( "Input : "+new String(input)+ "\nPWD : "+new String(digest)
}
}