md5_file comes up with a random pick between 2 results

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.

Answers


Need Your Help

How do I use the Time class on hash values?

ruby hash

I am working through Chris Pine's Ruby book, and I am slightly confused why my code doesn't quite work.

Android ndk OpenGL texture recovery

android opengl-es android-ndk textures

Recomened to call onResume and onPause events for GLSurface in Activity.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.