Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7829863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:56:50+00:00 2026-06-02T10:56:50+00:00

I have a multidimensional array of Bytes defined as follows: type TRow = array[0..6]

  • 0

I have a multidimensional array of Bytes defined as follows:

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

Now, I would like to generate a unique checksum of each row the array consists of and save to a file, like so:

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

What should I do about the GenerateChecksum() function? I’ve tried xor and CRC32, but they are not really suitable for this task, as they return duplicated values. I’d like to generate a unique checksum for each row.

EDIT
Oh, the checksum should be computed in such way that it allows to compare rows. I would like to take two checksums of different rows and tell whether one of them is greater than the other, lesser than the other, or equal. Is there a chance of achieving something like that?

EDIT2
Example data in two adjacent rows:

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

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:56:51+00:00Added an answer on June 2, 2026 at 10:56 am

    Your data just sounds incoherent to me. You defined an array[0..6] of byte, but in your example of data, you have values outside the byte range, i.e. 0..255, like 444, 323, 1024… There is an error somewhere.

    Since each row only contains 7 bytes of data, the easiest is to wrap it into an Int64 value. This is not a crc, but just a typecast. So by definition, you won’t have any collision here – this is a perfect hash.

    It is some kind of “hash of the poor”, but it would be very easy.

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

    I’ve defined the function as inline since it will be faster.

    You’ll have one byte overlapping of memory access for the last TRow in your array, but it will work as expected. To avoid this, a slower but safer function:

    function HashOf(const Row: TRow): Int64;
    begin
      result := 0;
      move(Row,result,sizeof(Row));
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very large multidimensional array and I would like to sort it
I have a multidimensional array that is behaving unexpectedly and I would like to
I have an multidimensional array that looks like this: Array ( [0] => Array
I have a multidimensional array, and I would have multiple arrays within it. Some
I have a multidimensional array of bools, with each element set to true: var
I have a multidimensional array that looks something like this: ourThing = array( 'id'
I have a multidimensional array that look like this: Array [1] => Array (
I have a multidimensional-array which looks like this: $array = ( [0] => array
I have a multidimensional array that looks like this: Array ( [0] => Array
I have a multidimensional array. The contents look like this in the debugger. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.