Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php对同一图像使用不同的哈希_Php_Hash_Md5_Unique - Fatal编程技术网

php对同一图像使用不同的哈希

php对同一图像使用不同的哈希,php,hash,md5,unique,Php,Hash,Md5,Unique,我有两个相同的图像存储在两个不同的服务器(dropbox和我自己的)。 然而,我意识到 hash("md5",file_get_contents($image1)) hash("md5",file_get_contents($image2)) 正在为这些相同的图像返回不同的哈希值。 如何确保它们都返回相同的字符串?您考虑过使用md5\u文件吗 md5_file($image1); md5_file($image2); 您是否确实验证了$image1和$image2的内容?@PeeHaa即使图

我有两个相同的图像存储在两个不同的服务器(dropbox和我自己的)。 然而,我意识到

hash("md5",file_get_contents($image1))
hash("md5",file_get_contents($image2))
正在为这些相同的图像返回不同的哈希值。
如何确保它们都返回相同的字符串?

您考虑过使用md5\u文件吗

md5_file($image1);
md5_file($image2);

您是否确实验证了
$image1
$image2
的内容?@PeeHaa即使图像是相同的,在散列的元数据中也可能存在细微的差异。@PeeHaa可能过于迂腐,元数据在技术上不算作“内容”;)@嗯,我喜欢迂腐。值得思考。
文件获取内容($image1)==文件获取内容($image2)
返回
true
false
?如果您使用的是类unix操作系统,可以尝试在两台服务器上使用
md5sum
命令行工具。谢谢!数千像素中的一个像素被一个值关闭。