|
使用mhash库生成校验码应用实例
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
margin-left: 10px;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
}
-->
</style>
<?php
$filename = '07.txt';
$str = file_get_contents($filename);
$hash = 2;
$password = '111';
$salt = '1234';
$key = mhash_keygen_s2k(1,$password,$salt,10);
$str_mhash = bin2hex(mhash($hash,$str,$key));
echo "文件07.txt的校验码是:".$str_mhash;
?>
执行结果:
文件07.txt的校验码是:e99996fdefcd9eb5b094fc7770c7b7e3be0beea6
|
|