D
D
dvsor2021-08-27 17:54:38
reverse engineering
dvsor, 2021-08-27 17:54:38

What does this miracle function (ARM/Thumb) (SAMP ANDROID) do?

During the reverse of the SAMP client on android, I stumbled upon this miracle:

some kind of game
https://pastebin.com/5Ue6wYM0
ну или (бесполезный) псевдокод:
void __fastcall encrypt(int *a1, char *a2, unsigned int a3, int a4)
{
  int v4; // [sp+38h] [bp+8h]

  if ( !(a3 >> 2) )
    JUMPOUT(0x88922);
  sub_88868(a3 >> 2, (int)a2, a3, a4, v4);
}



a bit of listing after this function to a obviously different function (forcibly turned it into code, before that there was the usual undefined):
not much game yet
https://pastebin.com/bxE55ViG

arrays (more precisely, references to them) of 4 ints and 8 chars, respectively, are passed in 1 and 2 arguments. 3 and 4 argument - 8 and 32.
calling a miracle

.text:00094A6C                 ADD.W           R0, R6, #0x398 ; a1 - int[4]
.text:00094A70                 ADD.W           R1, R6, #0x3B8 ; a2 - char[8]
.text:00094A74                 MOVS            R2, #8  ; a3
.text:00094A76                 MOVS            R3, #0x20 ; ' ' ; a4
.text:00094A78

если что, в R6 находится SP

I tried to change the bounds, but there are a lot of undefined variables and nothing useful, respectively ...
I hope someone more experienced than me can understand what this function does with the second argument.
and yes, according to my tests, it produces a different result every time with the same values.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question