Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

MD5 Hash or CRC32 or Adler32 - Which one would take less computation time?

807569Aug 12 2006 — edited Aug 13 2006
Hi,
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2006
Added on Aug 12 2006
1 comment
1,290 views