Checking files for testing

Yesterday I worked on quality, conducting official testing. In their procedure, they verified that all files on the test machine were extracted from the release. The way they checked these files was the same, checking the size and date and time windows placed on them in Windows Explorer. This happened for another reason, and I was able to find out why.

Is this a valid way to check a file the same? I didn’t think so and started arguing, but I’m younger, so I thought that I should not promote it too much. I would argue that they should do a binary comparison in the file in order to check its contents for accuracy. In my experience, time and date stamps and size attributes do not always work as expected. Any thoughts ???

+5
source share
5 answers

The only 100% way to find out if two files are equal is to perform a binary comparison of the two.

If you can live with the risk of false positives (i.e. two files that are not 100% identical, but your code says they are), then digest and checksum algorithms can be used to reduce performance, especially if the files live on two different machines with less than optimal bandwidth, so binary comparison is not possible.

Digest and checksum algorithms have every chance of false positives, but the exact chance depends on the algorithm. The general rule is that the more crypto, the more it gives out, the less likely there is a false positive.

CRC-32 , .

/ , , , .

, , , , , .

+3

. , - , WinMerge TextWrangler, . .

, , , , , , . , , , 100% , , , , , , "svn update" .

, ( ), svn -r .

+3

- md5sum . , , .

+1

hash . MD5 SHA1 . md5sum Unix, Wikipedia md5sum Windows.

+1

CRC ... :

Loop redundancy checking , the type of hash function used to create the checksum to detect errors during transmission or storage.

It produces an almost unique value based on the contents of the file.

0
source

All Articles