.text:0804A194 ; Encoder: (byte level) .text:0804A194 ; Co = Po + 0x17 .text:0804A194 ; Cn = Pn + Cn-1 + 0x17, for n > 0 .text:0804A194 ; .text:0804A194 ; => Decoder: (byte-level) .text:0804A194 ; => Pn = Cn - Cn-1 - 0x17, for n > 0 .text:0804A194 ; => Po = Co - 0x17 .text:0804A194 ; .text:0804A194 ; Attributes: bp-based frame .text:0804A194 .text:0804A194 Encoder proc near ; CODE XREF: MainMonster+286p .text:0804A194 ; MainMonster+582p .text:0804A194 .text:0804A194 var_C = byte ptr -0Ch .text:0804A194 LengthToEncode = dword ptr 8 .text:0804A194 PlainText = dword ptr 0Ch .text:0804A194 Cipher = dword ptr 10h .text:0804A194 .text:0804A194 push ebp .text:0804A195 mov ebp, esp .text:0804A197 push edi .text:0804A198 push esi .text:0804A199 push ebx .text:0804A19A mov edi, [ebp+LengthToEncode] .text:0804A19D mov esi, [ebp+PlainText] .text:0804A1A0 mov ebx, [ebp+Cipher] .text:0804A1A3 mov al, ds:gState1 .text:0804A1A9 mov [ebx], al .text:0804A1AB .text:0804A1AB Encode_First_Byte: ; Co = Po + 0x17 .text:0804A1AB mov al, [esi] .text:0804A1AD add al, 17h ; Add .text:0804A1AF movsx eax, al ; Move with Sign-Extend .text:0804A1B2 push eax .text:0804A1B3 push offset aC ; "%c" .text:0804A1B8 push ebx .text:0804A1B9 call sprintf ; Call Procedure .text:0804A1B9 .text:0804A1BE mov ecx, 1 .text:0804A1C3 cmp ecx, edi ; Compare Two Operands .text:0804A1C5 jz short ExitEncoder ; Jump if Zero (ZF=1) .text:0804A1C5 .text:0804A1C7 nop ; No Operation .text:0804A1C8 .text:0804A1C8 Encode_Other_Bytes: ; CODE XREF: Encoder+47j .text:0804A1C8 movzx edx, byte ptr [ebx+ecx-1] ; Cn = Cn-1 + Pn + 0x17 .text:0804A1CD movzx eax, byte ptr [ecx+esi] ; Move with Zero-Extend .text:0804A1D1 lea eax, [edx+eax+17h] ; Load Effective Address .text:0804A1D5 mov [ecx+ebx], al .text:0804A1D8 inc ecx ; Increment by 1 .text:0804A1D9 cmp ecx, edi ; Compare Two Operands .text:0804A1DB jnz short Encode_Other_Bytes ; Cn = Cn-1 + Pn + 0x17 .text:0804A1DB .text:0804A1DD .text:0804A1DD ExitEncoder: ; CODE XREF: Encoder+31j .text:0804A1DD lea esp, [ebp-0Ch] ; Load Effective Address .text:0804A1E0 pop ebx .text:0804A1E1 pop esi .text:0804A1E2 pop edi .text:0804A1E3 mov esp, ebp .text:0804A1E5 pop ebp .text:0804A1E6 retn ; Return Near from Procedure .text:0804A1E6 .text:0804A1E6 Encoder endp