23.03.2013 Views

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

loc_80484B8:<br />

loc_80484D3:<br />

pop ebx<br />

pop esi<br />

pop ebp<br />

retn<br />

crc endp<br />

\<br />

push esi<br />

mov esi, [ebp+key]<br />

push ebx<br />

mov ebx, [ebp+hash]<br />

test ebx, ebx<br />

mov eax, ebx<br />

jz short loc_80484D3<br />

nop ; padding<br />

lea esi, [esi+0] ; padding; ESI doesn’t changing here<br />

mov ecx, eax ; save previous state of hash <strong>to</strong> ECX<br />

xor al, [esi+edx] ; AL=*(key+i)<br />

add edx, 1 ; i++<br />

shr ecx, 8 ; ECX=hash>>8<br />

movzx eax, al ; EAX=*(key+i)<br />

mov eax, dword ptr ds:crctab[eax*4] ; EAX=crctab[EAX]<br />

xor eax, ecx ; hash=EAX^ECX<br />

cmp ebx, edx<br />

ja short loc_80484B8<br />

GCC aligned loop start by 8-byte border by adding NOP and lea esi, [esi+0] (that’s idle operation<br />

<strong>to</strong>o). Read more about it in npad section 2.3.<br />

64

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!