I have heard that open source software uses these. Are they computed on an entire file? Like if you changed one letter of Moby Dick the hash would be different?

I am curious about these for keeping track of changes in some files that are between 1k and 1M characters.

Is here a ball park in practical terms for how long it takes to compute a hash for 1k and 1M char file respectively? Should I worry about this issue?

  • For those filesizes you shouldn't have to worry. – Louis Waweru Sep 17 '14 at 5:46

Have a look at this: http://en.wikipedia.org/wiki/MD5#Applications

MD5 was the first widely popular hash that's computed on the entire file. It has some severe security issues, which is why it isn't in use as much anymore. By reading up on MD5 and how it was used, you'll find the answers to most if not all of your follow up questions.

But in simplified terms, if you hash any content a and apply a good hash function you get a binary hash value x. Make any change to content a, no matter how big or small, to generate content a'. The hash value of content a' is now a new hash value x', with each bit of x' having a 50% chance to be different from the corresponding bit in x.

Of course this means if you use a 32 bit hash, after you make any change to a you have a 2^-32 (0.000000023283%) probability to still get the exact same hash value. That's why hashes are usually longer than 32 bit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.