« 定義済み定数
Mhash 関数 »

例

例1 MD5 ダイジェストと hmac を計算し、16 進数で出力する

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

上の例の出力は以下となります。

The hash is d03cb659cbf9192dcd066272249f8412 
The hmac is 750c783e6ab0b503eaa86e310a5db738 

関連キーワード:
hash   hmac   input   Mhash   mhash   定数   ダイジェスト   計算   what   want   nothing   Jefe
関連する関数・ページ:
function.hash-hmac-file   function.hash-hmac   function.mhash-get-hash-name   ref.hash   ref.mhash   function.mhash