Exemplo #1 Calcula o hash e hmac MD5 e exibe como hexadecimal
<?php
$input = "what do ya want for nothing?";
$hash = mhash(MHASH_MD5, $input);
echo "O hash Ć© " . bin2hex($hash) . "<br />\n";
$hash = mhash(MHASH_MD5, $input, "Jefe");
echo "O hmac Ć© " . bin2hex($hash) . "<br />\n";
?>O exemplo acima produzirĆ”:
O hash Ć© d03cb659cbf9192dcd066272249f8412 O hmac Ć© 750c783e6ab0b503eaa86e310a5db738