I found myself in the need to hash something in Java and as I don't understand hashing I'm here.
I already found that there's no simple method for it.
So my question: how is whirlpool hashing done in Java?
EDIT: I was suggested GNU Whirlpool, but I can't get it to work
Whirlpool wp = new Whirlpool();
String s = "The quick brown fox jumps over the lazy dog";
byte[] b = s.getBytes(Charset.forName("UTF-8"));
wp.update(b, 0, s.length());
byte[] r = wp.digest();
String str = new String(r,Charset.forName("UTF-8"));
System.out.println(str);
And the output is:
<?R??XF
????n?g?Tl??H?po??????? m?
5?F ??
y?QhTM?|?I???
Am I missing something? Or did I not understand how it works?
Solve: It seems the digest
method outputs raw byte data. I converted it to HEX format using a method from Apache common codec library.
Use GNU Whirlpool. This is a java implementation of Whirlpool from GNU.