【加密函数分享】PHP函数hash_file ()分享(2021-5-11)
发布于 2021-05-12 23:20 ,所属分类:区块连和PHP开发学习资料
每日分享PHP知识点,大家都赞同是一种动力,分享是一种美德,再说了分享一下又不会怀孕?只要你开心就好......
hash_file ()使用给定文件的内容生成哈希值
string hash_file ( string $algo , string $filename [, bool $raw_output = false ] )
比较两个字符串,无论它们是否相等,本函数的时间消耗是恒定的。
本函数可以用在需要防止时序攻击的字符串比较场景中, 例如,可以用在比较 crypt() 密码哈希值的场景。
参数
algo
filename
raw_output
<?php
/* 创建一个要计算哈希值的文件 */
file_put_contents('example.txt', 'The quick brown fox jumped over the lazy dog.');
echo hash_file('md5', 'example.txt');
?>
5c6ffbdd40d9556b73a21e63c3e0e904


相关资源