This testing was with an ~100MB video file. Hashing always came back sub-second at around an average of 865ms. Averaged over 1000 runs, I got this method at 1063ms, and the method below (straightforward byte by byte comparison) at 3031ms. In my testing, I was able to see this outperform a straightforward ReadByte() scenario by almost 3:1.
If (BitConverter.ToInt64(one,0) != BitConverter.ToInt64(two,0)) Using (FileStream fs2 = second.OpenRead())
Using (FileStream fs1 = first.OpenRead()) Int iterations = (int)Math.Ceiling((double)first.Length / BYTES_TO_READ) If (string.Equals(first.FullName, second.FullName, StringComparison.OrdinalIgnoreCase)) Static bool FilesAreEqual(FileInfo first, FileInfo second) Here's what I came up with: const int BYTES_TO_READ = sizeof(Int64)
The fastest I've been able to come up with is a similar comparison, but instead of one byte at a time, you would use an array of bytes sized to Int64, and then compare the resulting numbers. The slowest possible method is to compare two files byte by byte.