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 7607549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:41:30+00:00 2026-05-31T00:41:30+00:00

I need to check the data integrity in the following situation: the data is

  • 0

I need to check the data integrity in the following situation: the data is writen to storage in chunks of different size (for each chunk we know its offset in the final file). However, the chunks come in arbitrary order and in multiple threads. They are read back from the storage in a completely different order (and the chunks have different size).

What I currently have in mind is the following:

    #define MODEST_PRIME 1021
    unsigned char checkbuf[MODEST_PRIME];
    void check_function(unsigned char *chunk, size_t offset, size_t length, unsigned char *result)
    {
       size_t i;
       for(i=0; i<length; i++)
           result[(i+offset)%MODEST_PRIME]^=chunk[i];
    }

This seems to offer protection from changing of any single byte and (to some extent) against
swapping of the chunks (it is unlikely that the distance between the swapping blocks will be divisible by the large prime). The results of this function for different chunks can be just xored together, so it is completely parallelizable.

However, this function looks highly unsofisticated in comparison to md5 sum, or any other modern hash function. But as far as I understand the computation of md5 sum or sha-1 sum can not be done in arbitrary order.

Well, the question is, do we have any better solution that

  1. Can be computed in an arbitrary order if we know the size and offset of the chunks (like the simple algorithm I’ve outlined above).
  2. Can offer a data integrity check at least comparable to that of md5 sum.
  • 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-05-31T00:41:32+00:00Added an answer on May 31, 2026 at 12:41 am

    One option is a tree-like checksuming hierarchy.

    With two levels you would put the chunks at the 1st (bottom) level of the tree. The 2nd level of the tree is a byte-array created by concatenating the checksums from the lower level.

    This works with any hash function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to check the following data and report the number of rows those
Before inserting data into table i need to check against duplicate records and report
I need to check if a variable I have is of the data type
In my SQL query I just need to check whether data exists for a
I have a list of links and need to check some data in it.
I need to check if the data of a newly created OverlayItem is already
I'm in need of some assistance in traversing three ranges (sheets) and check data
I'm adding data to a db and I only need to check for duplicated
I need to check data update periodly, but the data is only updating during
I have this scenario where I need data integrity in the physical database. For

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.