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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:12:19+00:00 2026-05-22T03:12:19+00:00

I have a large dataset (~1GB) stored in a custom file format, the last

  • 0

I have a large dataset (~1GB) stored in a custom file format, the last 16 bytes of which is an MD5 hash of all previous bytes of the file.

I want to verify the MD5 of this file against the embedded MD5 using HashAlgorithm.ComputeHash(Stream), however this will calculate the hash of the entire file INCLUDING the hash in the last 16bytes, which obviously wont work.

How do I compute the MD5 hash of PART of a stream? I know I can read the stream into an array and pass this to HashAlgorithm.ComputeHash(Bytes), however the overhead of duplicating this 1GB of data in memory is prohibitive.

  • 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-22T03:12:20+00:00Added an answer on May 22, 2026 at 3:12 am

    Taken from here where you can also get other ways of doing so.

    Make a partial file stream class, read the size you want and make hash of it.

     class PartialFileStream : FileStream
    {
        public PartialFileStream(string path, FileMode mode, long startPosition, long endPosition): base(path, mode)
    {
      base.Seek(startPosition, SeekOrigin.Begin);
      ReadTillPosition = endPosition;
    }
    
    public long ReadTillPosition { get; set; }
    
    public override int Read(byte[] array, int offset, int count)
    {
     if (base.Position >= this.ReadTillPosition)
       return 0;
    
     if (base.Position + count > this.ReadTillPosition)
       count = (int)(this.ReadTillPosition - base.Position);
    
     return base.Read(array, offset, count);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im working with a large dataset of point of interest (POI) which all have
I have a rather large dataset in text file with about 25 million rows
Prelude: I have a large dataset with several hundred thousand records stored in a
I have a large typed dataset which I want to partially fill for unit
I have a very large dataset which I am currently writing out to a
I have a large dataset (over 100,000 records) that I wish to load into
I have a large dataset that I am dealing with in Python. It is
Imagine you have a large dataset that may or may not be filtered by
Say if I have a large dataset, the table has well over a million
I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints.

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.