I have tried a bunch of different ways to solve this and referred to endless SO posts and most of them lead me to the hex encoded value.
Based on one of the answers on formatting the output I thought the following snippet would do the trick
Formatter formatter = new Formatter();
for (byte b : hash) {
formatter.format("%02o", b);
}
return formatter.toString();
I am trying to emulate the php sha1 function with the second parameter set to true.
Any help is much appreciated.
Add code snippets to show difference http://ideone.com/9KNYuN
http://sandbox.onlinephpfunctions.com/code/fee17c41bd1baf688fea1ff66dbf48a3d86108c3