MD5 Hash or CRC32 or Adler32 - Which one would take less computation time?
807569Aug 12 2006 — edited Aug 13 2006Hi,
I m trying to write a software to monitor files in directories. One of my feature would be to check if contents of files have changed. I know one simple way of doing this is to just call File.lastModified(). However, it doesn't seem reliable to me particularly coz there may be issue of users clock synchronization if the resource is shared and also an errant user could always call File.setLastModified() to upset the tracking system. This leaves me with the option of generating signatures from the contents. I have tried with MD5 but found that it is computationally expensive particularly if there are a lot of files involved. I was wondering if I could see a significant improvement in performance if I use CRC32 instead. I assume it may be the case given that CRC is predominantly bitwise XOR operations. How about Adler32 ? Could anyone share a light on this or perhaps suggest an even faster alternative. Many thanks for your advice.
Regards,
Jeevandra Sivarajah