logoalt Hacker News

pabs3yesterday at 8:38 AM1 replyview on HN

I feel like that is quite unlikely. Both the hash and bitwise comparisons read both files in both cases. In the not-equal case the hash reads the entirety of both files, so its slower than a start-to-end bitwise comparison, which exits at the first not-equal bit. In the equal case, both read the entirety of both files. Various other bitwise strategies can be faster than start-to-end, rdfind for example checks the start of the file first, then the end, then the rest of the file.


Replies

illiac786yesterday at 11:56 AM

I think we’re not talking about the same scenario. I’m talking about the case where at least one hash has already been calculated.