I am working with payU credit card systems. But I dont manage. payU tells me that I have to create hmac md5 hashes.
My secret key is : 3~9#[X4^660?ak+]h6%T I want to
this php function class worked for me:
function hmac ($key, $data)
{
// RFC 2104 HMAC implementation for php.
// Creates an md5 HMAC.
// Eliminates the need to install mhash to compute a HMAC
// Hacked by Lance Rushing
$b = 64; // byte length for md5
if (strlen($key) > $b) {
$key = pack("H*",md5($key));
}
$key = str_pad($key, $b, chr(0x00));
$ipad = str_pad('', $b, chr(0x36));
$opad = str_pad('', $b, chr(0x5c));
$k_ipad = $key ^ $ipad ;
$k_opad = $key ^ $opad;
return md5($k_opad . pack("H*",md5($k_ipad . $data)));
}
$x_fp_hash = hmac($string1,$string2);
You can easily do that using the hash_hmac() function:
$input = 'foo';
$output = hash_hmac('md5', $input, $secretKey);
where $secretKey
holds a string representation of your key.