To determine, whether 2 files are identical, I first would compare their sizes.
If they are identical, I would calculate a 32bit CRC sum for each of them and compare the results.
It is extremely unlikely that the files are different but have the same CRC.
Someone asked me:
"Are you sure? Take for example two files, where the only difference would
be that in one of them, I turned a "hello" into a "ehllo". I guess the checksum
would be the same, don't you think?"
Answer: No, a CRC might even tell you where the difference was (if the files are really that short).
The following function does compute such a 32bit CRC (cyclic redundancy check) value:
function ComputeFileCRC32(const FileName : string): LongInt;
Since the polynome table is rather long, you may download the pascal file: crc32.zip (2.2kB).
To compare, use something like this:
function Ident (const fn1, fn2 : string) : boolean;
begin
Ident := ComputeFileCRC32(fn1) = ComputeFileCRC32(fn2);
end;