Function at 0x408220
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x54
push ebx
mov ebx, dword [esp + 0x5c]
push ebp
mov ebp, dword [esp + 0x68]
mov eax, dword [ebx + 4]
push esi
mov edx, dword [ebp + 4]
mov dword [esp + 0x38], eax
mov eax, dword [ebx + 8]
or ecx, 0xffffffff
push edi
mov edi, dword [ebp + 8]
test eax, eax
mov dword [esp + 0x28], ecx
mov dword [esp + 0x10], 1
mov dword [esp + 0x68], edx
mov dword [esp + 0x1c], eax
jge 0x408264
neg eax
mov dword [esp + 0x10], ecx
mov dword [esp + 0x1c], eax
test edi, edi
jge 0x408274
mov eax, dword [esp + 0x10]
neg eax
mov dword [esp + 0x10], eax
neg edi
push ebp
call fcn.004067e0
mov esi, eax
push ebx
mov dword [esp + 0x40], esi
call fcn.004067e0
lea ebx, [edi - 2]
mov ecx, dword [esp + 0x7c]
imul ebx, esi
add esp, 8
add ebx, ecx
dec edi
mov dword [esp + 0x54], eax
mov dword [esp + 0x40], edi
imul edi, esi
add edi, ecx
xor ecx, ecx
mov cx, word [ebp + 0xe]
mov dword [esp + 0x58], ebx
cmp ecx, 0x18
mov dword [esp + 0x70], edi
je 0x4082cc
cmp ecx, 0x20
je 0x4082c5
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x54
ret
mov ebp, 4
jmp 0x4082d1
mov ebp, 3
mov ecx, dword [esp + 0x10]
test ecx, ecx
jge 0x4082e5
mov ecx, dword [esp + 0x1c]
dec ecx
imul ecx, eax
add dword [esp + 0x6c], ecx
mov edx, dword [esp + 0x68]
lea esi, [edx*4]
push esi
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
test eax, eax
mov dword [esp + 0x18], eax
jne 0x408309
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x54
ret
push esi
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov ecx, eax
test ecx, ecx
mov dword [esp + 0x2c], ecx
jne 0x408331
mov eax, dword [esp + 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_LocalFree]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x54
ret
mov edx, dword [esp + 0x68]
xor eax, eax
test edx, edx
mov dword [esp + 0x34], eax
jle 0x408465
mov esi, dword [esp + 0x3c]
dec esi
dec edx
mov dword [esp + 0x44], edx
mov edx, dword [esp + 0x6c]
add edx, ebp
mov dword [esp + 0x3c], esi
mov dword [esp + 0x48], edx
lea edx, [edi + 1]
mov esi, edi
sub edi, edx
sub esi, edx
mov dword [esp + 0x14], edx
mov edx, dword [esp + 0x2c]
mov dword [esp + 0x20], esi
mov esi, dword [esp + 0x18]
add edi, 2
mov dword [esp + 0x24], edi
sub esi, edx
shl eax, 8
imul eax, dword [esp + 0x3c]
cdq
idiv dword [esp + 0x44]
add ecx, 4
mov edx, eax
sar edx, 8
mov edi, edx
shl edi, 8
sub eax, edi
mov edi, dword [esp + 0x48]
mov dword [ecx + esi - 4], eax
mov eax, edx
imul eax, ebp
mov edx, dword [esp + 0x6c]
mov dword [ecx - 4], eax
mov dl, byte [eax + edx]
mov byte [esp + 0x30], dl
xor edx, edx
mov dl, byte [edi + eax]
mov eax, dword [esp + 0x30]
and eax, 0xff
mov edi, dword [esp + 0x14]
sub edx, eax
mov al, byte [esp + 0x30]
imul edx, dword [ecx + esi - 4]
shr edx, 8
add dl, al
mov eax, dword [esp + 0x20]
mov byte [edi + eax], dl
mov edx, dword [ecx - 4]
mov eax, dword [esp + 0x6c]
lea edi, [edx + eax]
xor edx, edx
mov al, byte [edi + 1]
mov dl, byte [edi + ebp + 1]
mov byte [esp + 0x4c], al
and eax, 0xff
sub edx, eax
mov al, byte [esp + 0x4c]
imul edx, dword [ecx + esi - 4]
shr edx, 8
add dl, al
mov eax, dword [esp + 0x14]
mov byte [eax], dl
mov edx, dword [ecx - 4]
mov eax, dword [esp + 0x6c]
lea edi, [edx + eax]
xor edx, edx
mov al, byte [edi + 2]
mov dl, byte [edi + ebp + 2]
mov byte [esp + 0x50], al
and eax, 0xff
sub edx, eax
mov al, byte [esp + 0x50]
imul edx, dword [ecx + esi - 4]
mov edi, dword [esp + 0x14]
shr edx, 8
add dl, al
mov eax, dword [esp + 0x24]
mov byte [edi + eax], dl
mov eax, dword [esp + 0x34]
mov edx, dword [esp + 0x68]
inc eax
add edi, ebp
cmp eax, edx
mov dword [esp + 0x34], eax
mov dword [esp + 0x14], edi
jl 0x40837d
mov edi, dword [esp + 0x70]
mov ecx, dword [esp + 0x40]
xor eax, eax
test ecx, ecx
mov dword [esp + 0x3c], eax
jle 0x4086ca
mov edx, dword [esp + 0x1c]
dec edx
mov dword [esp + 0x50], edx
shl eax, 8
imul eax, dword [esp + 0x50]
cdq
idiv ecx
mov ecx, dword [esp + 0x28]
mov edx, eax
mov dword [esp + 0x4c], eax
sar edx, 8
cmp edx, ecx
mov dword [esp + 0x28], edx
je 0x4085b5
mov ecx, dword [esp + 0x38]
mov esi, edi
mov eax, ecx
mov edi, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [esp + 0x68]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea esi, [edx + 1]
mov ecx, dword [esp + 0x6c]
imul esi, dword [esp + 0x54]
imul esi, dword [esp + 0x10]
add esi, ecx
test eax, eax
jle 0x4086a3
mov eax, dword [esp + 0x70]
mov ecx, dword [esp + 0x2c]
mov edx, eax
lea edi, [eax + 1]
sub eax, edi
sub edx, edi
add eax, 2
mov dword [esp + 0x20], edx
mov edx, dword [esp + 0x18]
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x68]
sub edx, ecx
mov dword [esp + 0x14], eax
mov eax, dword [ecx]
add ecx, 4
add eax, esi
mov bl, byte [eax]
mov byte [esp + 0x34], bl
xor ebx, ebx
mov bl, byte [eax + ebp]
mov eax, dword [esp + 0x34]
and eax, 0xff
sub ebx, eax
mov al, byte [esp + 0x34]
imul ebx, dword [ecx + edx - 4]
shr ebx, 8
add bl, al
mov eax, dword [esp + 0x20]
mov byte [edi + eax], bl
mov eax, dword [ecx - 4]
add eax, esi
mov bl, byte [eax + 1]
mov byte [esp + 0x30], bl
xor ebx, ebx
mov bl, byte [eax + ebp + 1]
mov eax, dword [esp + 0x30]
and eax, 0xff
sub ebx, eax
mov al, byte [esp + 0x30]
imul ebx, dword [ecx + edx - 4]
shr ebx, 8
add bl, al
mov byte [edi], bl
mov eax, dword [ecx - 4]
add eax, esi
mov bl, byte [eax + 2]
mov byte [esp + 0x1c], bl
xor ebx, ebx
mov bl, byte [eax + ebp + 2]
mov eax, dword [esp + 0x1c]
and eax, 0xff
sub ebx, eax
mov al, byte [esp + 0x1c]
imul ebx, dword [ecx + edx - 4]
shr ebx, 8
add bl, al
mov eax, dword [esp + 0x24]
mov byte [edi + eax], bl
mov eax, dword [esp + 0x14]
add edi, ebp
dec eax
mov dword [esp + 0x14], eax
jne 0x408503
mov ebx, dword [esp + 0x58]
mov eax, dword [esp + 0x4c]
mov edi, dword [esp + 0x70]
mov edx, dword [esp + 0x28]
mov ecx, dword [esp + 0x68]
test ecx, ecx
jle 0x4086a7
mov ecx, edi
mov esi, eax
sub ecx, ebx
mov eax, ebx
shl edx, 8
mov dword [esp + 0x4c], ecx
mov ecx, dword [esp + 0x74]
sub esi, edx
mov edx, ecx
sub edx, ebx
mov dword [esp + 0x24], 1
mov dword [esp + 0x48], edx
mov edx, edi
sub edx, ebx
sub edi, ebx
inc edx
add edi, 2
mov dword [esp + 0x44], edx
mov edx, ecx
sub edx, ebx
sub ecx, ebx
inc edx
add ecx, 2
mov dword [esp + 0x60], ecx
mov ecx, dword [esp + 0x68]
mov dword [esp + 0x14], edx
mov dword [esp + 0x5c], edi
mov dword [esp + 0x20], ecx
mov edi, dword [esp + 0x4c]
mov cl, byte [eax]
xor edx, edx
and ecx, 0xff
mov dl, byte [edi + eax]
mov edi, dword [esp + 0x44]
sub edx, ecx
mov cl, byte [eax]
imul edx, esi
sar edx, 8
add dl, cl
mov ecx, dword [esp + 0x48]
mov byte [ecx + eax], dl
mov edx, dword [esp + 0x24]
mov cl, byte [edx + eax]
xor edx, edx
mov dl, byte [edi + eax]
and ecx, 0xff
sub edx, ecx
mov ecx, dword [esp + 0x24]
imul edx, esi
sar edx, 8
add dl, byte [ecx + eax]
mov ecx, dword [esp + 0x14]
mov edi, dword [esp + 0x5c]
mov byte [ecx + eax], dl
mov ecx, 2
xor edx, edx
mov cl, byte [ecx + eax]
mov dl, byte [edi + eax]
and ecx, 0xff
mov edi, 2
sub edx, ecx
imul edx, esi
mov cl, byte [edi + eax]
sar edx, 8
add dl, cl
mov ecx, dword [esp + 0x60]
mov byte [ecx + eax], dl
mov ecx, dword [esp + 0x20]
add eax, ebp
dec ecx
mov dword [esp + 0x20], ecx
jne 0x408612
mov edi, dword [esp + 0x70]
mov edx, dword [esp + 0x38]
mov eax, dword [esp + 0x74]
mov ecx, dword [esp + 0x40]
add eax, edx
mov dword [esp + 0x74], eax
mov eax, dword [esp + 0x3c]
inc eax
cmp eax, ecx
mov dword [esp + 0x3c], eax
jl 0x408480
mov eax, dword [esp + 0x18]
mov esi, dword [sym.imp.KERNEL32.dll_LocalFree]
push eax
call esi
mov ecx, dword [esp + 0x2c]
push ecx
call esi
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x54
ret