hashes are just a number so a collision is certain with a large enough dataset. CRC is usually 32 - 64 bits and MD5 is 128 bit. They are pretty good at making sure you have the file you knew you wanted - i.e. checking for transmission errors. To check against a duplicate file I would want something better. At least the MD5 , filelength , and first n bytes of the file (32+?). If all three were the same it would be a real good check but not definitive. The more you can check against the better until you actually compare byte-to-byte the two files.
My 2c, David Lloyd -- lloydhome consulting, inc. http://lloydhome.com On Feb 20, 11:44 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Not really a cake question... but I was wondering... is md5 or crc a > good way to check if two files are identical? > > I guess my question is, what are the chances that md5_file would > create the same hash for 2 different files? I assume this is highly > unlikely, but not really my area of expertise. > > Thanks, > cook --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---