Blog Archive for April 21, 2011

Calculate HMAC Hash in Java

April 21, 2011

I needed to calculate a HMAC hash in Java, getting the same format as php's hash_hmac() function in return.

This can be done using the following Java function:

private static String buildHmacSignature(String pKey, String pStringToSign)
{
  String lSignature = "None";
  try
  {
    Mac lMac = …

Tags: hmac hash java