Array element checksum

I have a multidimensional array Bytes, which is defined as follows:

type
  TRow = array[0..6] of Byte;
var
  All: array[0..19112079] of TRow;  

Now I would like to create a unique checksum of each row that the array consists of and save to a file:

var
  I: Integer;
begin
  for I := 0 to 19112079 do
  begin
    Checksum := GenerateChecksum(All[I]);
    Writeln(F, Checksum);
  end;
end;

What should I do with the function GenerateChecksum()? I tried xorand CRC32, but they are not suitable for this task, as they return duplicate values. I would like to create a checksum unique for each line.

EDIT Oh, the checksum should be calculated so that it allows you to compare strings. I would like to take two checksums from different lines and say one of them is larger than the other, smaller than the other, or equal. Is there a chance to achieve something like this?

EDIT2 :

Row x - 1: 120, 444, 323, 984, 1024, 76, 130
Row x:     120, 444, 323, 984, 1024, 76, 222
Row x + 1: 120, 444, 323, 984, 1024, 76, 121
. . .
Row x + n: 120, 444, 323, 984, 6333, 33, 935

.

+3
2

. array[0..6] of byte, , .. 0..255, 444, 323, 1024... - .

7 , Int64. crc, . - .

" ", .

function HashOf(const Row: TRow): Int64; inline;
begin
  result := PInt64(@Row)^ and $00ffffffffffffff;
end;

inline, .

TRow , , . , , :

function HashOf(const Row: TRow): Int64;
begin
  result := 0;
  move(Row,result,sizeof(Row));
end;
+6

7 , , . UInt64. 7 TRow UInt64, .

function PackRow(const Row: TRow): UInt64;
begin
  Result := 0;
  Move(Row, Result, SizeOf(Row));
end;

, .

+3

All Articles