Delphi-Quellcode:
type
TDynByteArray = array of Byte;
function ChecksumDyn(const AData: TDynByteArray; AValue: Byte): Byte;
var
Index: Integer;
begin
Result := AValue;
for Index := Low(AData) to High(AData) do
Result := Result xor AData[Index];
end;
oder
Delphi-Quellcode:
function ChecksumPtr(AData: PByte; ASize: Cardinal; AValue: Byte): Byte;
begin
Assert(Assigned(AData)
or (ASize = 0));
Result := AValue;
while ASize > 0
do
begin
Result := Result
xor AData^;
Inc(AData);
Dec(ASize);
end;
end;
oder...
(kommt darauf an, wie du die Daten verwaltest)