# Reverser Wanted

Hello, I’m looking for someone to understand and rewrite the following code to something understandable (python if possible):

https://i.imgur.com/BXGJZvB.png

If you are interested, please send your proposal including price as a private message or if you need more details.

good

``````# -*- coding: utf-8 -*-

def shr32(val, width):
return val >> width

def shl32(val, width):
return (val << width) & 0xFFFFFFFF

def get_dword(data, offset=0):
b1 = data[offset+0]
b2 = data[offset+1]
b3 = data[offset+2]
b4 = data[offset+3]
return (b4 << 24) + (b3 << 16) + (b2 << 8) + b1

dword_61A918 = [0, 0, 0, 0] * 0x100

def sub_448690(ecx, edx):
eax = shr32(ecx, 0x18)
eax = get_dword(dword_61A918, eax*4)
ecx = shl32(ecx, 8)
edx &= 0xFF
ecx |= edx
return eax ^ edx

print(hex(sub_448690(10, 20)))
``````

Sorry, but didn’t work or I don’t get how to implement it (most probably). Let me explain how the code works then maybe you can give me a clue:

Step 1 - binary generates a random hex (let’s use 8711 as example);
Step 2 - binary takes the input string and split it in characters using unicode. For example, if I write 12345678, the script is called 8 times (8 chars on string), and first input will be 31 (Unicode for 1);
Step 3 - code keep in loop for string lenght as I said. In the example, 8 times.
Step 4 - The output, does not matter string lenght, is a 4 hex digit string. Using “0x8711” as salt, I get “C1 5E B2 6D” on output.

``````dword_61A918 = [0, 0, 0, 0] * 0x100
``````

You need to fill the dword_61A918 array with the correct values from the program.

After some modifications and corrections, I got it working. Thanks Darwin. 