Ejemplos

Ejemplo #1 Calcula el MD5 y el hmac, y lo imprime como hexadecimal

<?php
$input
= "what do ya want for nothing?";
$hash = mhash(MHASH_MD5, $input);
echo
"El hash es " . bin2hex($hash) . "<br />\n";
$hash = mhash(MHASH_MD5, $input, "Jefe");
echo
"El hmac es " . bin2hex($hash) . "<br />\n";
?>

El resultado del ejemplo sería:

El hash es d03cb659cbf9192dcd066272249f8412 
El hmac es 750c783e6ab0b503eaa86e310a5db738 

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top