Function at 0x52a110
Capabilities:
Encode data using xor
Encrypt data using twofish

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x74
mov eax, dword [0x5ac020]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, dword [ebp + 0x14]
push esi
mov esi, dword [ebp + 8]
mov dword [ebp - 0x54], ebx
test esi, esi
jne 0x52a146
push 0x164
push 0x564470
push str.key___NULL
call fcn.0052cf10
add esp, 0xc
test ebx, ebx
jne 0x52a161
push 0x165
push 0x564470
push str.skey___NULL
call fcn.0052cf10
add esp, 0xc
mov eax, dword [ebp + 0x10]
cmp eax, 0x10
je 0x52a182
test eax, eax
je 0x52a182
pop esi
mov eax, 4
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004ffcef
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp + 0xc]
cmp ecx, 0x10
je 0x52a1a9
cmp ecx, 0x18
je 0x52a1a9
cmp ecx, 0x20
je 0x52a1a9
pop esi
mov eax, 3
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004ffcef
mov esp, ebp
pop ebp
ret
mov eax, ecx
cdq
and edx, 7
push edi
lea edi, [edx + eax]
sar edi, 3
mov dword [ebp - 0x3c], edi
test ecx, ecx
jle 0x52a1cb
push ecx
lea eax, [ebp - 0x34]
push esi
push eax
call fcn.00502510
add esp, 0xc
test edi, edi
jle 0x52a1f1
mov ebx, dword [ebp - 0x3c]
lea esi, [ebp - 0x34]
lea edi, [ebp - 0x14]
push edi
push esi
call fcn.0052a900
add esp, 8
add edi, 4
add esi, 8
dec ebx
jne 0x52a1d8
mov edi, dword [ebp - 0x3c]
mov ebx, dword [ebp - 0x54]
xor eax, eax
lea ecx, [ebx + 0x1004]
mov dword [ebp - 0x44], eax
mov dword [ebp - 0x40], ecx
nop
mov bl, al
lea eax, [ebp - 0x34]
push 0
push edi
push eax
lea eax, [ebp - 0x3c]
add bl, bl
push eax
lea eax, [ebp - 0x38]
mov byte [ebp - 0x38], bl
push eax
mov byte [ebp - 0x37], bl
mov byte [ebp - 0x36], bl
mov byte [ebp - 0x35], bl
call fcn.0052a740
mov esi, dword [ebp - 0x3c]
lea eax, [ebp - 0x34]
push 1
push edi
push eax
lea eax, [ebp - 0x3c]
inc bl
push eax
lea eax, [ebp - 0x38]
mov byte [ebp - 0x38], bl
push eax
mov byte [ebp - 0x37], bl
mov byte [ebp - 0x36], bl
mov byte [ebp - 0x35], bl
call fcn.0052a740
mov ecx, dword [ebp - 0x3c]
add esp, 0x28
mov edx, dword [ebp - 0x40]
rol ecx, 8
lea eax, [ecx + esi]
mov dword [edx - 4], eax
lea eax, [esi + ecx*2]
rol eax, 9
mov dword [edx], eax
add edx, 8
mov eax, dword [ebp - 0x44]
inc eax
mov dword [ebp - 0x40], edx
mov dword [ebp - 0x44], eax
cmp eax, 0x14
jl 0x52a200
movzx ebx, byte [ebp - 0x14]
movzx eax, byte [ebp - 0x10]
cmp edi, 2
jne 0x52a381
mov esi, dword [ebp - 0x54]
xor edi, edi
mov dword [ebp - 0x40], eax
add esi, 0x800
movzx eax, byte [ebp - 0x13]
mov dword [ebp - 0x44], eax
movzx eax, byte [ebp - 0xf]
mov dword [ebp - 0x3c], eax
movzx eax, byte [ebp - 0x12]
mov dword [ebp - 0x38], eax
movzx eax, byte [ebp - 0xe]
mov dword [ebp - 0x50], eax
movzx eax, byte [ebp - 0x11]
mov dword [ebp - 0x4c], eax
movzx eax, byte [ebp - 0xd]
mov dword [ebp - 0x48], eax
mov edi, edi
mov ecx, edi
lea esi, [esi + 4]
and ecx, 0xff
inc edi
mov al, byte [ecx + 0x563270]
movzx edx, al
mov cl, byte [ecx + 0x563370]
mov eax, edx
xor eax, ebx
xor edx, dword [ebp - 0x38]
movzx ecx, cl
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x40]
movzx eax, byte [eax + 0x563370]
mov eax, dword [eax*4 + 0x563470]
mov dword [esi - 0x804], eax
mov eax, ecx
xor eax, dword [ebp - 0x44]
xor ecx, dword [ebp - 0x4c]
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x3c]
movzx eax, byte [eax + 0x563270]
mov eax, dword [eax*4 + 0x563870]
mov dword [esi - 0x404], eax
movzx eax, byte [edx + 0x563370]
xor eax, dword [ebp - 0x50]
movzx eax, byte [eax + 0x563370]
mov eax, dword [eax*4 + 0x563c70]
mov dword [esi - 4], eax
movzx eax, byte [ecx + 0x563370]
xor eax, dword [ebp - 0x48]
movzx eax, byte [eax + 0x563270]
mov eax, dword [eax*4 + 0x564070]
mov dword [esi + 0x3fc], eax
cmp edi, 0x100
jl 0x52a2c0
pop edi
pop esi
xor eax, eax
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004ffcef
mov esp, ebp
pop ebp
ret
cmp edi, 3
jne 0x52a4c8
mov dword [ebp - 0x48], eax
xor edi, edi
movzx eax, byte [ebp - 0xc]
mov dword [ebp - 0x4c], eax
movzx eax, byte [ebp - 0x13]
mov esi, dword [ebp - 0x54]
mov dword [ebp - 0x50], eax
add esi, 0x800
movzx eax, byte [ebp - 0xf]
mov dword [ebp - 0x40], eax
movzx eax, byte [ebp - 0xb]
mov dword [ebp - 0x44], eax
movzx eax, byte [ebp - 0x12]
mov dword [ebp - 0x3c], eax
movzx eax, byte [ebp - 0xe]
mov dword [ebp - 0x38], eax
movzx eax, byte [ebp - 0xa]
mov dword [ebp - 0x58], eax
movzx eax, byte [ebp - 0x11]
mov dword [ebp - 0x64], eax
movzx eax, byte [ebp - 0xd]
mov dword [ebp - 0x60], eax
movzx eax, byte [ebp - 9]
mov dword [ebp - 0x5c], eax
mov edi, edi
mov eax, edi
lea esi, [esi + 4]
and eax, 0xff
inc edi
mov dl, byte [eax + 0x563270]
mov al, byte [eax + 0x563370]
movzx ecx, al
mov eax, ecx
xor ecx, dword [ebp - 0x50]
xor eax, ebx
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x48]
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x4c]
movzx eax, byte [eax + 0x563370]
mov eax, dword [eax*4 + 0x563470]
mov dword [esi - 0x804], eax
movzx eax, byte [ecx + 0x563370]
xor eax, dword [ebp - 0x40]
movzx ecx, dl
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x44]
movzx eax, byte [eax + 0x563270]
mov eax, dword [eax*4 + 0x563870]
mov dword [esi - 0x404], eax
mov eax, ecx
xor eax, dword [ebp - 0x3c]
xor ecx, dword [ebp - 0x64]
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x38]
movzx eax, byte [eax + 0x563370]
xor eax, dword [ebp - 0x58]
movzx eax, byte [eax + 0x563370]
mov eax, dword [eax*4 + 0x563c70]
mov dword [esi - 4], eax
movzx eax, byte [ecx + 0x563370]
xor eax, dword [ebp - 0x60]
movzx eax, byte [eax + 0x563370]
xor eax, dword [ebp - 0x5c]
movzx eax, byte [eax + 0x563270]
mov eax, dword [eax*4 + 0x564070]
mov dword [esi + 0x3fc], eax
cmp edi, 0x100
jl 0x52a3e0
pop edi
pop esi
xor eax, eax
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004ffcef
mov esp, ebp
pop ebp
ret
mov dword [ebp - 0x5c], eax
xor edi, edi
movzx eax, byte [ebp - 0xc]
mov dword [ebp - 0x60], eax
movzx eax, byte [ebp - 8]
mov dword [ebp - 0x64], eax
movzx eax, byte [ebp - 0x13]
mov dword [ebp - 0x58], eax
movzx eax, byte [ebp - 0xf]
mov dword [ebp - 0x48], eax
movzx eax, byte [ebp - 0xb]
mov dword [ebp - 0x4c], eax
movzx eax, byte [ebp - 7]
mov esi, dword [ebp - 0x54]
mov dword [ebp - 0x50], eax
add esi, 0x800
movzx eax, byte [ebp - 0x12]
mov dword [ebp - 0x40], eax
movzx eax, byte [ebp - 0xe]
mov dword [ebp - 0x44], eax
movzx eax, byte [ebp - 0xa]
mov dword [ebp - 0x3c], eax
movzx eax, byte [ebp - 6]
mov dword [ebp - 0x38], eax
movzx eax, byte [ebp - 0x11]
mov dword [ebp - 0x74], eax
movzx eax, byte [ebp - 0xd]
mov dword [ebp - 0x6c], eax
movzx eax, byte [ebp - 9]
mov dword [ebp - 0x68], eax
movzx eax, byte [ebp - 5]
mov dword [ebp - 0x70], eax
jmp 0x52a540
mov eax, edi
lea esi, [esi + 4]
and eax, 0xff
inc edi
mov cl, byte [eax + 0x563270]
mov al, byte [eax + 0x563370]
movzx edx, al
mov eax, edx
movzx ecx, cl
xor eax, ebx
xor edx, dword [ebp - 0x74]
movzx eax, byte [eax + 0x563370]
xor eax, dword [ebp - 0x5c]
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x60]
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x64]
movzx eax, byte [eax + 0x563370]
mov eax, dword [eax*4 + 0x563470]
mov dword [esi - 0x804], eax
mov eax, ecx
xor eax, dword [ebp - 0x58]
xor ecx, dword [ebp - 0x40]
movzx eax, byte [eax + 0x563370]
xor eax, dword [ebp - 0x48]
movzx eax, byte [eax + 0x563370]
xor eax, dword [ebp - 0x4c]
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x50]
movzx eax, byte [eax + 0x563270]
mov eax, dword [eax*4 + 0x563870]
mov dword [esi - 0x404], eax
movzx eax, byte [ecx + 0x563270]
xor eax, dword [ebp - 0x44]
movzx eax, byte [eax + 0x563270]
xor eax, dword [ebp - 0x3c]
movzx eax, byte [eax + 0x563370]
xor eax, dword [ebp - 0x38]
movzx eax, byte [eax + 0x563370]
mov eax, dword [eax*4 + 0x563c70]
mov dword [esi - 4], eax
movzx eax, byte [edx + 0x563270]
xor eax, dword [ebp - 0x6c]
movzx eax, byte [eax + 0x563370]
xor eax, dword [ebp - 0x68]
movzx eax, byte [eax + 0x563370]
xor eax, dword [ebp - 0x70]
movzx eax, byte [eax + 0x563270]
mov eax, dword [eax*4 + 0x564070]
mov dword [esi + 0x3fc], eax
cmp edi, 0x100
jl 0x52a540
mov ecx, dword [ebp - 4]
xor eax, eax
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.004ffcef
mov esp, ebp
pop ebp
ret