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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:35:35+00:00 2026-05-27T08:35:35+00:00

signed int _rotr( int a1, int a2 ) { return (a1 << a2 %

  • 0
signed int _rotr( int a1, int a2 )
{
    return (a1 << a2 % 0x20u) | ((unsigned int)a1 >> (char)(32 - a2 % 0x20u));
}
int _encrypt_password( int a1, int a2, signed int a3 )
{
    signed int  v10; // [sp+10h] [bp-8h]@3
    int         result; // eax@1
    int         v4; // ebx@3
    int         v5; // edi@3
    int         v6; // esi@3
    int         v7; // eax@4
    int         v8; // [sp+14h] [bp-4h]@2
    int         v9; // [sp+Ch] [bp-Ch]@2

    result = 8 * a3 / 8;
    a3 = 8 * a3 / 8;
    if ( result > 0 )
    {
        result = a2;
        v8 = 0;
        v9 = a2;
        while ( a3 / 8 > v8 )
        {
            v4 = *(_DWORD *)v9 + *(_DWORD *)(a1 + 16);
            v6 = *(_DWORD *)(v9 + 4) + *(_DWORD *)(a1 + 20);
            v10 = 1;
            v5 = a1 + 24;
            do
            {
                v7 = *(_DWORD *)v5 + _rotr(v6 ^ v4, v6);
                v4 = v7;
                v6 = *(_DWORD *)(v5 + 4) + _rotr(v7 ^ v6, v7);
                ++v10;
                v5 += 8;
            }
            while ( v10 <= 12 );
            result = v9;
            *(_DWORD *)v9 = v4;
            *(_DWORD *)(v9 + 4) = v6;
            ++v8;
            v9 += 8;
        }
    }
    return result;
}

Above is a reverse engineered set of functions which provides the encryption of a string (password) for authentication of a game client to a game server. The original encryption is no longer available and it was reverse engineered for this purpose.

The code runs perfectly in 32bit, however, when compiling for 64bit systems I run into some problems. The code builds successfully as it does in 32bit, however upon execution of the function it segfaults (EXC_BAD_ACCESS) when it hits the first v4 assignment line:

v4 = *(_DWORD *)v9 + *(_DWORD *)(a1 + 16);

I have attempted to understand the function and figure out what sort of encryption its actually providing however I’ve failed at that miserably. I was running with RC5 at first, but that led to about 2 days of math that ultimately proved extremely valuable to my cryptography skills but futile to the problem at hand.

I’d like to know one or both things about this code:

First and easiest, does anyone recognize the algorithm or cryptographic method that this is using? Is it even using a standard method? It looks like RC5/ROT13/DES/AES in some way shape or form to me, but I can’t tell.

Second, is there any indication as to why this would fail to work in 64bit?

** Sorry, _DWORD is an unsigned long.

  • 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-27T08:35:35+00:00Added an answer on May 27, 2026 at 8:35 am

    Try replacing all the occurrences of int and _DWORD with int32_t (you’ll want to #include <stdint.h>. You said _DWORD is defined as unsigned long, which on many 32-bit machines will be a 32-bit quantity but on 64-bit machines will often be 64.

    Or if the function is actually called with addresses as its arguments, which it looks like it might be, you may want to try using int64_t everywhere. Do you have an example of how the function is invoked, and some example inputs on a 64-bit system?

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

Sidebar

Related Questions

unsigned long long value = 0; bool result = value >= std::numeric_limits<signed int>::min(); This
Are signed/unsigned mismatches necessarily bad? Here is my program: int main(int argc, char *argv[])
int main() { unsigned int b; signed int a; char z=-1; b=z; a=z; printf(%d
I am trying to convert 65529 from an unsigned int to a signed int
So I know that the difference between a signed int and unsigned int is
I have this C code: int test(signed char anim_col) { if (anim_col >= 31)
#include<stdio.h> int main(void) { signed int a=-1; unsigned int b=1; int c= a+b; printf(%d\n,c);
typedef unsigned char uChar; typedef signed char sChar; typedef unsigned short uShort; typedef signed
I got an array which contains signed int data, i need to convert each
If I have: signed char * p; and I do a comparison: if (

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.