I've got this, which is a useful way of getting all 4 byte values in a form that I can then say "XOR that with that" :
function TForm1.Finder(SourceFile:TFileStream):String;
var
i, Value, BinaryBytesRead: Integer;
TotalBytesRead, SizeOfSourceFile : Int64;
SL : TStringList;
begin
TotalBytesRead := 0;
SL := TStringList.Create;
try
SourceFile.Position := 0;
SizeOfSourceFile := Sourcefile.Size;
while TotalBytesRead < SourceFile.Size do
begin
SourceFile.ReadBuffer(Value, SizeOf(Value));//read a 4 byte integer
inc(TotalBytesRead, SizeOf(Value));
SL.Add(IntToHex(SwapEndian(Value), 4));
end;
finally
SourceFile.Free;
for i := 0 to SL.Count -1 do
begin
Memo1.Lines.Add(SL[i]);
end;
SL.Free;
end;
end;
but it's obviously very slow, inefficient and memory intensive utilising a StringList, and when I apply it to large files (of several Gb), it will take hours!
What would be an equally convenient (i.e. not too confusing) way of storing these values like this (one 4 byte value at a time) but in a more memory efficient way?
Thanks