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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:38:11+00:00 2026-05-26T06:38:11+00:00

I was given the task of documenting an application that has no comments. However,

  • 0

I was given the task of documenting an application that has no comments. However, I have been unable to understand the following function.

private uint GetVersionHash(int encver, int realver)
{
    int EncryptedVersionNumber = encver;
    int VersionNumber = realver;
    int VersionHash = 0;
    int DecryptedVersionNumber = 0;
    string VersionNumberStr;
    int a = 0, b = 0, c = 0, d = 0, l = 0;

    VersionNumberStr = VersionNumber.ToString();

    l = VersionNumberStr.Length;

    // I am specifically struggling with the purpose and intent of this loop.

    for (int i = 0; i < l; i++)
    {
        VersionHash = (32 * VersionHash) + (int)VersionNumberStr[i] + ;
    }

    a = (VersionHash >> 24) & 0xFF;
    b = (VersionHash >> 16) & 0xFF;
    c = (VersionHash >> 8) & 0xFF;
    d = VersionHash & 0xFF;
    DecryptedVersionNumber = (0xff ^ a ^ b ^ c ^ d);

    if (EncryptedVersionNumber == DecryptedVersionNumber)
    {
        return Convert.ToUInt32(VersionHash);
    }
    else
    {
        return 0;
    }
}

With my current understanding it bitshift 5 right and adds some value.

Also some further information:

  • encver appears to be an encrypted version as an int (it is read from a file)
  • realver seems to be version we are testing for match. It is looped in another function to this function from short.MinValue to short.MaxValue

What is the purpose of this loop? How does the code achieve this purpose?

  • 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-26T06:38:12+00:00Added an answer on May 26, 2026 at 6:38 am

    The loop is calculating a ‘hash’ of the characters (digits) in the string representing the real version number. The value of VersionHash is a number which depends on every character in the string, the length of the string, and their order.

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

Sidebar

Related Questions

Simple task: given that an article has many comments, be able to display in
I have been given the task of internationalizing a large client-server application. The remit
I have been given task to check for url that site:domain (If index in
I have been given a task that can be simplified to this scenario: Customers
I have been given the task to design and develop a web application for
I have been given a task to create a Python file that will take
I have been given a task to display data on an ASP .net page
I have been given the task to convert an uncompressed movie to H.264 format.
I have been given a task to create a bridge between C# and Java.
I have been given the task of rewriting an internal utility in .Net 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.