hrefspace

 找回密码
 立即注册
搜索
热搜: PHP PS 程序设计
查看: 1687|回复: 0

使用mhash库生成校验码

[复制链接]

880

主题

1087

帖子

3444

积分

超级版主

Rank: 8Rank: 8

积分
3444

论坛头条论坛元老谋士数据帝优秀版主超级版主见习版主论坛版主

发表于 2023-2-18 15:47:18 | 显示全部楼层 |阅读模式
使用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
世界上最遥远的距离,不是生与死的距离,而是我站在你面前,你却不知道我爱你
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|hrefspace

GMT+8, 2024-3-28 22:03 , Processed in 0.063474 second(s), 22 queries .

Powered by hrefspace X3.4 Licensed

Copyright © 2022, hrefspace.

快速回复 返回顶部 返回列表