Function at 0x581d40
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
push ebx
push esi
mov esi, dword [ebp + 8]
mov bl, byte [esi]
mov ecx, dword [esi + 0x28]
mov eax, dword [esi + 0x2c]
mov byte [ebp - 1], bl
mov dword [ebp - 8], ecx
mov dword [ebp - 0xc], eax
test bl, 0x40
jne 0x581d6c
push eax
lea eax, [esi + 0x10]
push eax
push esi
call ecx
add esp, 0xc
movzx eax, bl
mov edx, 0xf
and eax, 7
xor ecx, ecx
sub edx, eax
mov byte [esi], al
mov dword [ebp - 0x18], edx
cmp edx, 0xf
jae 0x581d98
movzx eax, byte [edx + esi]
or ecx, eax
mov byte [edx + esi], 0
inc edx
shl ecx, 8
cmp edx, 0xf
jb 0x581d85
movzx eax, byte [esi + 0xf]
mov ebx, dword [ebp + 0x14]
or ecx, eax
mov byte [esi + 0xf], 1
cmp ecx, ebx
je 0x581db2
pop esi
or eax, 0xffffffff
pop ebx
mov esp, ebp
pop ebp
ret
push edi
cmp ebx, 0x10
jb 0x581e5b
mov edi, 0xfffffff8
mov eax, ebx
sub edi, esi
shr eax, 4
mov dword [ebp - 0x14], eax
mov eax, dword [ebp + 0x10]
mov dword [ebp - 0x10], eax
mov eax, dword [ebp + 0xc]
mov dword [ebp + 0x14], eax
push dword [ebp - 0xc]
lea eax, [ebp - 0x28]
push eax
push esi
call dword [ebp - 8]
add esp, 0xc
lea eax, [esi + 0x10]
nop dword [eax + eax]
add byte [eax - 1], 1
lea eax, [eax - 1]
jne 0x581e00
lea ecx, [edi + eax]
test ecx, ecx
jne 0x581df0
mov eax, dword [ebp + 0x14]
mov edx, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x28]
push dword [ebp - 0xc]
xor ecx, dword [eax]
mov eax, dword [eax + 4]
xor eax, dword [ebp - 0x24]
mov dword [edx + 4], eax
mov dword [edx], ecx
xor dword [esi + 0x14], eax
xor dword [esi + 0x10], ecx
mov eax, dword [ebp + 0x14]
mov ecx, dword [ebp - 0x20]
xor ecx, dword [eax + 8]
mov eax, dword [eax + 0xc]
xor eax, dword [ebp - 0x1c]
mov dword [edx + 0xc], eax
mov dword [edx + 8], ecx
xor dword [esi + 0x1c], eax
lea eax, [esi + 0x10]
xor dword [esi + 0x18], ecx
push eax
push eax
call dword [ebp - 8]
add dword [ebp + 0x14], 0x10
add esp, 0xc
add dword [ebp - 0x10], 0x10
sub ebx, 0x10
sub dword [ebp - 0x14], 1
jne 0x581dd7
mov edi, dword [ebp - 0x10]
jmp 0x581e64
mov eax, dword [ebp + 0xc]
mov edi, dword [ebp + 0x10]
mov dword [ebp + 0x14], eax
test ebx, ebx
je 0x581ebe
push dword [ebp - 0xc]
lea eax, [ebp - 0x28]
push eax
push esi
call dword [ebp - 8]
add esp, 0xc
test ebx, ebx
je 0x581eab
lea ecx, [ebp - 0x28]
lea edx, [esi + 0x10]
mov eax, ecx
mov esi, dword [ebp + 0x14]
sub esi, eax
sub edi, eax
nop dword [eax]
mov al, byte [esi + ecx]
lea ecx, [ecx + 1]
xor al, byte [ecx - 1]
lea edx, [edx + 1]
mov byte [edi + ecx - 1], al
xor byte [edx - 1], al
sub ebx, 1
jne 0x581e90
mov esi, dword [ebp + 8]
mov edi, dword [ebp - 0xc]
lea eax, [esi + 0x10]
mov ebx, dword [ebp - 8]
push edi
push eax
push eax
call ebx
add esp, 0xc
jmp 0x581ec4
mov ebx, dword [ebp - 8]
mov edi, dword [ebp - 0xc]
mov ecx, dword [ebp - 0x18]
cmp ecx, 0x10
jae 0x581ee2
mov eax, 0x10
sub eax, ecx
push eax
lea eax, [ecx + esi]
push 0
push eax
call fcn.005d6d60
add esp, 0xc
push edi
lea eax, [ebp - 0x28]
push eax
push esi
call ebx
mov eax, dword [ebp - 0x28]
add esp, 0xc
xor dword [esi + 0x10], eax
mov eax, dword [ebp - 0x24]
xor dword [esi + 0x14], eax
mov eax, dword [ebp - 0x20]
xor dword [esi + 0x18], eax
mov eax, dword [ebp - 0x1c]
xor dword [esi + 0x1c], eax
mov al, byte [ebp - 1]
pop edi
mov byte [esi], al
xor eax, eax
pop esi
pop ebx
mov esp, ebp
pop ebp
ret