function CompFile(const f1,f2: string): Boolean;
var
fs1,fs2: TFileStream;
ms: TMemoryStream;
i,p: Integer;
b1,b2: Byte;
begin
Result := False;
if not (FileExists(f1) and FileExists(f2)) then Exit;
fs1 := TFileStream.Create(f1, fmOpenRead);
fs2 := TFileStream.Create(f2, fmOpenRead);
if fs1.Size <> fs2.Size then
begin
fs1.Free;
fs2.Free;
Exit;
end;
Result := True;
Randomize;
for i := 0 to 9 do
begin
p := Random(fs1.Size);
fs1.Position := p;
fs2.Position := p;
fs1.ReadBuffer(b1,1);
fs2.ReadBuffer(b2,1);
if b1 <> b2 then
begin
Result := False;
Break;
end;
end;
fs1.Free;
fs2.Free;
end;