title: Why isn't random byte comparison a good method of testing equality?
body: <p>I have two 50G+ files I want to compare for equality. </p>
  
  <p>'<code>diff -a</code>' or '<code>cmp</code>' would work, but are slow. </p>
  
  <p>Hashing both files and comparing the hashes would be faster(?), but 
  still fairly slow.</p>
  
  <p>Instead, suppose I randomly selected 10,000 numbers between 1 and 50G, 
  and compared those specific bytes in the two files, using seek() for speed. </p>
  
  <p>I claim the chance 10,000 randomly selected bytes will match in the 
  two files by coincidence is about 256^10000 to 1 (or about 1 in 
  10^2408). </p>
  
  <p>This makes it orders of magnitude better than any known hash function, 
  and much faster. </p>
  
  <p>So, what's wrong with this argument? Why isn't random byte testing 
  superior to hashing? </p>
  
  <p>This question inspired by: </p>
  
  <p><a href="https://stackoverflow.com/questions/784585/what-is-the-fastest-way-to-check-if-files-are-identical">What is the fastest way to check if files are identical?</a> </p>
  
  <p>(where I suggest a similar, but slightly different method) </p>