public class MainClass { public static void main(String args[]) throws Exception {
SecretKeySpec k = new SecretKeySpec("1234".getBytes(), "HMACSHA1");
Mac m = Mac.getInstance("HmacMD5");
m.init(k);
m.update("test".getBytes("UTF8")); byte s[] = m.doFinal(); for (int i = 0; i < s.length; i++) {
System.out.print( Integer.toHexString((0x000000ff & s[i]) | 0xffffff00).substring(6));
}
}
}