So I am struggling with this code. I am trying to write a function in PHP that would effectively do the same thing as this method in C#:
private string CalculateSignature(string apiKey, string secretKey, long timeStamp)
{
// Generate the hash
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
HMACMD5 hmac = new HMACMD5(encoding.GetBytes(secretKey));
byte[] hash = hmac.ComputeHash(encoding.GetBytes(apiKey + timeStamp));
// Convert hash to digital signature string
string signature = BitConverter.ToString(hash).Replace("-", "").ToLower();
return signature;
}
This is all I have so far:
function calcSignature($apiKey, $secrekKey, $timeStamp)
{
$retval = hash_hmac('md5', $secrekKey, $apiKey . $timeStamp, false);
return $retval;
}
Any help would be greatly appreciated, thanks!