Different hash value created on windows,linux and Mac for same image
Windows and Linux has different line endings, \r\n and \n. So when the file is read, the content of files is different.
Try uploading Text file with no new line or a Binary file. Also check difference in bytes read. It should be equal to number of new lines in next file.
Ok i found answer to my question, I still dont know why there are two different hashes been generated for the same code in windows and Linux
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $newname);
"Stored in: " . "upload/" . $_FILES["file"]["name"];
$image = "upload/" . $newname;
$sign = md5(file_get_contents($image));//This is code block that i was implmenting before solution
What i tried here was i replaced my above code with following code
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $newname);
"Stored in: " . "upload/" . $_FILES["file"]["name"];
$image = "upload/" . $newname;
$sign = md5_file($image);// Changed here
From this i think Hash values may be same when generated by md5()
but if this function accepts file as input then hash values are calculated differently, i dont know if this is a PHP side issue or really OS level issue but if i go on with using md5_file()
for generating hash of file i dont get different hash.