- hash_hmac: documentation ( source)
- dechex: documentation ( source)
- ord: documentation ( source)
<?php
$str = 'POST\n/auth/token\nproject=xRxyG0P5&ai=95335e7caf2f6a92&tm=1513574899';
$key = 'e68c202f73c54468b9822c843b320d34';
$signature = String2Hex(hash_hmac("sha256", $str, $key, true));
function String2Hex($string){
$hex='';
for ($i=0; $i < strlen($string); $i++){
$hex .= dechex(ord($string[$i]));
}
return $hex;
}
echo $signature;exit;
?>