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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:43:20+00:00 2026-05-16T22:43:20+00:00

I have a binary file, where are a few values what should be changed.

  • 0

I have a binary file, where are a few values what should be changed.
To be more exact, at two part of the file, in the beginning, there are two HEX values

66 73 69 6D 35 2E 36 39

what should be changed to

4D 53 57 49 4E 34 2E 31

How could I do this async, and as fast as possible? I’ve got to the point where I read the whole file into a byte[] array, but this class has no search or replace feature.

  • 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-16T22:43:20+00:00Added an answer on May 16, 2026 at 10:43 pm

    Here is a method I wrote which you can use to find where in your byte[] the bytes are that you are trying to find.

    /// <summary>
    /// Searches the current array for a specified subarray and returns the index
    /// of the first occurrence, or -1 if not found.
    /// </summary>
    /// <param name="sourceArray">Array in which to search for the
    /// subarray.</param>
    /// <param name="findWhat">Subarray to search for.</param>
    /// <param name="startIndex">Index in <paramref name="sourceArray"/> at which
    /// to start searching.</param>
    /// <param name="sourceLength">Maximum length of the source array to search.
    /// The greatest index that can be returned is this minus the length of
    /// <paramref name="findWhat"/>.</param>
    public static int IndexOfSubarray<T>(this T[] sourceArray, T[] findWhat,
            int startIndex, int sourceLength) where T : IEquatable<T>
    {
        if (sourceArray == null)
            throw new ArgumentNullException("sourceArray");
        if (findWhat == null)
            throw new ArgumentNullException("findWhat");
        if (startIndex < 0 || startIndex > sourceArray.Length)
            throw new ArgumentOutOfRangeException();
        var maxIndex = sourceLength - findWhat.Length;
        for (int i = startIndex; i <= maxIndex; i++)
        {
            if (sourceArray.SubarrayEquals(i, findWhat, 0, findWhat.Length))
                return i;
        }
        return -1;
    }
    
    /// <summary>Determines whether the two arrays contain the same content in the
    /// specified location.</summary>
    public static bool SubarrayEquals<T>(this T[] sourceArray,
            int sourceStartIndex, T[] otherArray, int otherStartIndex, int length)
            where T : IEquatable<T>
    {
        if (sourceArray == null)
            throw new ArgumentNullException("sourceArray");
        if (otherArray == null)
            throw new ArgumentNullException("otherArray");
        if (sourceStartIndex < 0 || length < 0 || otherStartIndex < 0 ||
            sourceStartIndex + length > sourceArray.Length ||
            otherStartIndex + length > otherArray.Length)
            throw new ArgumentOutOfRangeException();
    
        for (int i = 0; i < length; i++)
        {
            if (!sourceArray[sourceStartIndex + i]
                .Equals(otherArray[otherStartIndex + i]))
                return false;
        }
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 534k
  • Answers 534k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It used to be used in the attribute selectors, but… May 17, 2026 at 12:44 am
  • Editorial Team
    Editorial Team added an answer To add a button like this, you can use the… May 17, 2026 at 12:44 am
  • Editorial Team
    Editorial Team added an answer As far as a form is concerned, it makes no… May 17, 2026 at 12:44 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a binary file of unknown format that I need to be able
I am reading binary data from one file that specifies intensity values across x
I have a binary file that I need to insert a header at the
I have a binary file in the R.raw folder. Now I am able to
I have a binary file which contains image.i have to jump on different locations
A few months back I serialized a java.io.Serializable object into a file. Now I
I have a need to push out a file package that includes a driver
i have written an application, but for some reason it keeps peaking at 100%.
could some one help me out trying to understand how hard drive seeking works.
We have our app all ready to upload to Apple for approval but have

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.