为什么同一输入返回两个不同的MD5哈希值? [英] Why is the same input returning two different MD5 hashes?
问题描述
好的,我有两个文件.他们是完全一样的.
Alright, I have two files. They are the EXACT SAME.
第一个文件是:
http://iadsonline.com/servconfig.php
第二个文件是:
http://xzerox.info/servconfig.php
但是,当我使用md5_file()获取其MD5时,它们会返回两个不同的MD5.
However, when I use md5_file() to get their MD5, They return two different MD5's.
第一个返回不正确的cc7819055cde3194bb3b136bad5cf58d
,第二个返回正确的96a0cec80eb773687ca28840ecc67ca1
.
The first returns cc7819055cde3194bb3b136bad5cf58d
, which is incorrect, and the second returns 96a0cec80eb773687ca28840ecc67ca1
, which is correct.
该文件只是一个
为了验证,我使用了以下代码:
To verify, I've used this code:
$contents = file_get_contents($URL);
echo htmlentities($contents);
它们都返回
那为什么要对它们进行散列呢?
So why is it hashing them differently?
推荐答案
第二个以换行符结尾,第一个不以换行符结尾.
The second one ends in a newline, the first does not.
这篇关于为什么同一输入返回两个不同的MD5哈希值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!