龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php hmac-sha1加密算法示例

时间:2014-10-13 11:54来源:网络整理 作者:网络 点击:
分享到:
php hmac-sha1加密算法示例 [代码片段(10行)]
<?php
  $key = "0f2100e34b54d50fd0138f300d3497579dae5279";
  $data = "secret-message";
  $decodedKey = pack("H*", $key);
  $hmac = hash_hmac("sha1", $data, $decodedKey, TRUE);
  $signature = base64_encode($hmac);
  echo "key = $key\n";
  echo "data = $data\n";
  echo "signature = $signature";
?>
精彩图集

赞助商链接