I'm not sure if it's my code, or if a bug has recently been introduced into either TFileSearcher or the FindAllFiles procedure. I expect it's my code, but for the life of me, I can't see where it is, and the behaviour is unusual. Let me explain...
I have created a program called QuickHash (
https://sourceforge.net/projects/quickhash/) using Lazarus and FPC. It's a program that traverses directories of files and hashes the files using MD5, SHA1, SHA256 or SHA512 algorithms. MD5 and SHA1 utilise the built in FPC procedures. SHA256 and SHA512 utilise the DCPCrypt procedures.
I've recently updated to Lazarus 0.9.31 and FPC2.5.1. When I compile my program on Linux, everything works as expected and it always has done. Files are found in a directory, processed, and output to a StringGrid. However, on Windows, that very same code, when compiled into an exe, results in the same hash value being generated for every file found, but only when I use MD5 or SHA1. If I use SHA256 or SHA512, it works fine. I stress again that this problem DOES NOT occur on the Linux binary. Only the Windows one. For this reason I wondered if a bug has been introduced into one of the file finding routines so that different results are fed back for Windows systems whereas Linux systems are handled differenty? On the Linux system, I can jump between any of the 4 hashing algorithms, and correct hashes are computed for every file.
If anyone can spot the bug in my code (
https://sourceforge.net/projects/quickhash/files/SourceCode/), I'd sure appreciate it! But if not, and if anyone can confirm, I'll file a bug.
Ted