Function at 0x10005810
Capabilities:
Encrypt or decrypt via wincrypt
Generate random numbers via winapi

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c
push ebx
mov ebx, dword [ebp + 0xc]
push esi
push edi
xor edi, edi
and dword [ebp - 4], edi
push ebx
mov dword [ebp - 8], edi
call fcn.100050ef
mov esi, dword [ebp + 8]
push 0x10
mov eax, dword [esi + 0x10]
add eax, 0x20
push eax
lea eax, [ebx + 4]
push 0x10
push eax
call fcn.10012a78
mov eax, dword [esi + 0x58]
add esp, 0x14
test eax, eax
je 0x10005982
xor edx, edx
cmp dword [eax + 0xc], edx
je 0x10005982
cmp dword [eax + 0x3c], edx
je 0x1000597b
lea ecx, [ebp - 4]
push ecx
push edx
push edx
push dword [eax + 4]
call dword [sym.imp.ADVAPI32.dll_CryptDuplicateKey]
test eax, eax
jne 0x10005883
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x10005982
mov edi, dword [sym.imp.ADVAPI32.dll_CryptSetKeyParam]
lea eax, [ebp + 0xc]
push 0
push eax
push 4
push dword [ebp - 4]
mov dword [ebp + 0xc], 1
call edi
test eax, eax
je 0x10005876
lea eax, [ebp - 0x1c]
push eax
mov eax, dword [esi + 0x58]
push 0x10
push dword [eax]
call dword [sym.imp.ADVAPI32.dll_CryptGenRandom]
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x100058c1
call esi
mov dword [ebp - 8], eax
push 0
lea eax, [ebp - 0x1c]
push eax
push 1
push dword [ebp - 4]
call edi
test eax, eax
jne 0x100058d6
call esi
jmp 0x1000587c
push 1
call dword [sym.imp.WS2_32.dll_htonl]
mov edi, dword [ebx + 0x24]
shr edi, 4
inc edi
mov dword [ebx + 0x14], eax
shl edi, 4
lea eax, [edi + 0x30]
push eax
call fcn.1000f6be
mov ecx, dword [ebp + 0x10]
mov edx, dword [ebp + 0x14]
mov dword [ebp + 8], eax
mov dword [ecx], eax
add eax, 0x20
mov ecx, dword [ebx + 0x24]
mov dword [edx], ecx
push dword [ebx + 0x24]
lea esi, [eax + 0x10]
mov dword [ebp - 0xc], eax
push dword [ebx + 0x20]
push dword [ebx + 0x24]
push esi
call fcn.10012a78
add esp, 0x14
push edi
push dword [ebp + 0x14]
push esi
push 0
push 1
push 0
push dword [ebp - 4]
call dword [sym.imp.ADVAPI32.dll_CryptEncrypt]
test eax, eax
jne 0x10005941
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x10005944
mov edi, dword [ebp - 8]
mov esi, dword [ebp + 0x14]
mov eax, dword [esi]
add eax, 0x18
push eax
call dword [sym.imp.WS2_32.dll_ntohl]
push 0x20
push ebx
push 0x20
push dword [ebp + 8]
mov dword [ebx + 0x18], eax
add dword [esi], 0x30
call fcn.10012a78
push 0x10
lea eax, [ebp - 0x1c]
push eax
push 0x10
push dword [ebp - 0xc]
call fcn.10012a78
add esp, 0x20
jmp 0x10005985
mov dword [eax + 0x3c], 1
mov esi, dword [ebp + 0x14]
mov eax, dword [ebp + 0x10]
cmp dword [eax], 0
jne 0x100059ce
mov eax, dword [ebx + 0x24]
add eax, 0x20
push eax
mov dword [esi], eax
call fcn.1000f6be
mov esi, eax
mov eax, dword [ebp + 0x10]
pop ecx
push 0
mov dword [eax], esi
call dword [sym.imp.WS2_32.dll_htonl]
push 0x20
push ebx
push 0x20
push esi
mov dword [ebx + 0x14], eax
call fcn.10012a78
push dword [ebx + 0x24]
lea eax, [esi + 0x20]
push dword [ebx + 0x20]
push dword [ebx + 0x24]
push eax
call fcn.10012a78
add esp, 0x20
mov eax, dword [ebp + 0x14]
mov eax, dword [eax]
sub eax, 4
push eax
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
add eax, 4
push eax
push ebx
call fcn.100050ae
add esp, 0xc
cmp dword [ebp - 4], 0
je 0x100059f8
push dword [ebp - 4]
call dword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret