PHP Conference Kansai 2025

Ejemplos

Ejemplo #1 Calcule el MD5 y el hmac, luego lo muestra como un hexadecimal

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

El resultado del ejemplo sería:

El hash vale d03cb659cbf9192dcd066272249f8412
El hmac vale 750c783e6ab0b503eaa86e310a5db738

add a note

User Contributed Notes

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