The text of this article is not in this database — only its details are. Read it on the old site: Compare two files with Hash Algorithm
1 Comment
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
The text of this article is not in this database — only its details are. Read it on the old site: Compare two files with Hash Algorithm
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
Betty BoopPosted Sep 8, 2010, 6:58 AM
Dont be a noob coder! 1) HashAlgorithm ha = HashAlgorithm.Create(); Does not ensure a specific secure hash algorithm is selected. If the default is an old, broken, algorithm such as MD5, your code is vulnerable to colision attacks. 2) byte[] hash1 = ha.ComputeHash(f1); Also sucks back, for not implementing any responsiveness on the application (not to mention progress reporting to user). Just try to run your code with a large file (2 GBytes) or even a smaller file over a network share and your application will hang for very long time. 3) «in some cases comparing through hash algorithm is more efficient method» Bullshit! To compare byte by byte is always faster. Just use buffers, and dont lobotomize your code with noob implementations such as read 1 byte at the time from each file.