douyi7283 2013-01-23 23:49
浏览 39

md5_file提供了2个结果之间的随机选择

Similair to this question here: php md5_file function with gif file? but the answer doesn't cut it for my situation.

On certain images I apply a md5_file to, there are a few (out of 20000) that give 2 different results on a random basis.

Example code:

<?php
$moo = 'http://a1100.phobos.apple.com/us/r1000/069/Purple/v4/03/0f/cd/030fcd97-3958-5a96-f1ae-86e55382c529/mzl.lepmgpwz.350x350-75.jpg';
echo md5_file($moo);
?>

Results in either: 673ec8b2f87df0b41ebc17bba85edd9a OR: 235bf518387d59b13a7c820abe73d5eb

I tried to play around with md5(file_get_contents($moo)); and similair versions of sha1, and sha256, but the ones I tried all come up with 2 different results on a random basis.

My quick echo test notepad:

<?php
$moo = 'http://a1100.phobos.apple.com/us/r1000/069/Purple/v4/03/0f/cd/030fcd97-3958-5a96-f1ae-86e55382c529/mzl.lepmgpwz.350x350-75.jpg';
echo $moo.'<br /><br />';

echo '- '.md5(file_get_contents($moo)).'<br />';
echo '- '.md5_file($moo).'<br />';
echo '- '.md5($moo).'<br />';

echo '- '.sha1(file_get_contents($moo)).'<br />';
echo '- '.sha1_file($moo).'<br />';
echo '- '.sha1($moo).'<br/>';

?>

Is this common and is there any way to avoid this?

Right now I'm stuck with a few dead images since 1 function places md5_file('my_image'); in my dB with a different name than the resize function saved md5_file('my_image); as.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法