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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:26:50+00:00 2026-05-18T11:26:50+00:00

How to decode (shifting and xoring) a massive byte array in a fast way?

  • 0

How to decode (shifting and xoring) a massive byte array in a fast way?
I need it for a file viewer application that opens the archive file and decodes the files inside and display them to the user. The files are encrypted with a byte shifting and xoring system. It is impossible for me to change the algorithm. Currently, I just read all the bytes and then run the Decode function on them.

The decode function that I currently use:

    byte[] DecodeVOQ(byte[] EncodedBytes)
    {
        for (int i = 0; i < EncodedBytes.Length; i++)
        {
            EncodedBytes[i] ^= (byte)194;
            EncodedBytes[i] = (byte)((EncodedBytes[i] << 4) | (EncodedBytes[i] >> 4));
        }
        return EncodedBytes;
    }

Edit: I found out that the real performance problem is with displaying the text. Reading + Decoding is pretty fast.

  • 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-18T11:26:50+00:00Added an answer on May 18, 2026 at 11:26 am

    One possible optimization would be to precompute the output for any input byte. So you’d have:

    private static byte[] DecodedBytes = PrecomputeDecodedBytes();
    
    public static byte[] DecodeVOQ(byte[] data)
    {
        for (int i = 0; i < data.Length; i++)
        {
            data[i] = DecodedBytes[data[i]];
        }
        return data;
    }
    

    It’s quite possible that that will be slower than your existing bitshifting algorithm though. EDIT: I’ve just tried comparing this with the original bitshift but using a temporary local variable: they’re about the same.

    Have you benchmarked the current performance? Is it definitely too slow? In particular, loading the file from just about any storage medium will be much much slower than the cost of decoding. I’ve just tried this on my laptop – for 200MB of data, it takes about half a second. (EDIT: With Marcelo’s answer, it takes under half a second.) Is that really too slow?

    Would you be happy to use more than one processor? It’s an embarrassingly parallelizable routine, after all. If you’re using .NET 4, the TPL may well make this pretty simple.

    I should emphasize again though that this isn’t “encryption” – it’s a mild form of obfuscation, in the same way that the base-64 encoding of a username/password for basic HTTP authentication is.

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

Sidebar

Related Questions

I need to encode/decode UTF-16 byte arrays to and from java.lang.String . The byte
I need to decode and specifically target the first url only in this array:
I need to decode an MP3 file with Python. What is a good library
I need to extract and decode barcodes and text from images. Is there any
What is the most code free way to decode a string: \xD0\xAD\xD0\xBB\xD0\xB5\xD0\xBA\xD1\x82\xD1\x80\xD0\xBE\xD0\xBD\xD0\xBD\xD0\xB0\xD1\x8F to human
I have the string which that encoded in quoted-printable . How do I decode
I can decode the points, I just need to figure out how to loop
How do i encode and decode NSTimeInterval? when i do it in this way...
I am trying to decode a JSON string into an array but i get
I'm trying to decode the result of the Python os.wait() function. This returns, according

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.