If you want to beWould a hash really be faster? You'll still have to read both files completely and just add the calculation of the hash codes to the runtime. I don't see why simple, stupid comparison byte-by-byte should be slower than calculating two hashes (except of course if one of the hashes is pre-computed).
fast I think a hash is the way to go.
Comparing a hash, if you have to calculate it eachDepends on how good your hash is..but in general...yes. I was only saying that it's faster if you're always maintaining a has of the file.
time, is bound to be slower than a byte by byte, or
character by character compare.
This kind of comparison is used mostly in things like
content management systems, when a new file of data
is checked to see if it's identical to a file already
entered, hash values being stored for each file
already in the system.
And comparing the hashes can only prove the files are
different, if the hashes are equal that doesn't
absolutely guarantee that the files are the same.
Normally you'd confirm a matching hash by actually
comparing file content.