Function at 0x40d370
Capabilities:
Encrypt data using salsa20 or chacha
Encrypt or decrypt via wincrypt
Generate random numbers via winapi

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c
mov eax, dword [0x462040]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov dword [ebp - 8], 0x28
mov ebx, ecx
mov dword [ebp - 0xc], 0x62eb20
mov ecx, 5
mov eax, dword [ebp - 0xc]
push esi
mov dword [ebp - 0x1c], edx
push edi
cdq
mov edi, 3
idiv edi
mov esi, dword [ebp + 8]
mov eax, dword [ebp - 0xc]
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0x10], esi
mov dword [ebp - 0x14], ecx
test edx, edx
je 0x40d3f7
add eax, 2
add eax, esi
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d3d2
dec eax
or eax, 0xfffffffc
add eax, 1
jne 0x40d48e
mov eax, dword [ebp - 0xc]
inc eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d3f0
dec eax
or eax, 0xfffffffc
add eax, 1
je 0x40d3d8
jmp 0x40d48e
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d408
dec eax
or eax, 0xfffffffc
add eax, 1
je 0x40d442
mov ecx, dword [ebp - 0xc]
lea eax, [esi + 3]
add ecx, 2
imul ecx, eax
mov dword [ebp - 0xc], ecx
mov eax, dword [ebp - 0xc]
test al, 1
jne 0x40d48e
mov ecx, 5
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d435
dec eax
jmp 0x40d436
inc eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
test al, 1
je 0x40d425
jmp 0x40d48e
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
test edx, edx
je 0x40d48e
mov eax, dword [ebp - 0xc]
lea ecx, [esi + 0x17]
add eax, 0xb
cdq
idiv ecx
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
cdq
idiv edi
test edx, edx
jne 0x40d48e
mov ecx, 5
nop word [eax + eax]
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d480
inc eax
jmp 0x40d481
dec eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
cdq
idiv edi
test edx, edx
je 0x40d470
lea edi, [esi + 0x260]
push edi
push 0x20
push ebx
mov ebx, dword [sym.imp.ADVAPI32.dll_CryptGenRandom]
call ebx
test eax, eax
je 0x40d8da
mov dword [ebp - 0xc], 0x62eb20
mov ecx, 3
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d4ff
add eax, 2
add eax, edi
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d4da
dec eax
or eax, 0xfffffffc
add eax, 1
jne 0x40d59f
mov eax, dword [ebp - 0xc]
inc eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d4f8
dec eax
or eax, 0xfffffffc
add eax, 1
je 0x40d4e0
jmp 0x40d59f
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d510
dec eax
or eax, 0xfffffffc
add eax, 1
je 0x40d54d
mov ecx, dword [ebp - 0xc]
lea eax, [edi + 3]
add ecx, 2
imul ecx, eax
mov dword [ebp - 0xc], ecx
mov eax, dword [ebp - 0xc]
test al, 1
jne 0x40d59f
mov ecx, 5
nop dword [eax]
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d540
dec eax
jmp 0x40d541
inc eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
test al, 1
je 0x40d530
jmp 0x40d59f
mov eax, dword [ebp - 0xc]
mov ecx, 5
cdq
idiv ecx
test edx, edx
je 0x40d59f
mov eax, dword [ebp - 0xc]
lea ecx, [edi + 0x17]
add eax, 0xb
cdq
idiv ecx
mov ecx, 3
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
test edx, edx
jne 0x40d59f
nop word [eax + eax]
mov eax, dword [ebp - 0xc]
cdq
idiv dword [ebp - 0x14]
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d591
inc eax
jmp 0x40d592
dec eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
test edx, edx
je 0x40d580
add esi, 0x258
push esi
push 8
push dword [ebp - 0x18]
call ebx
test eax, eax
je 0x40d8da
mov dword [ebp - 0xc], 0x62eb20
mov ebx, 3
mov eax, dword [ebp - 0xc]
cdq
idiv ebx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d60f
add eax, 2
add eax, esi
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d5e7
dec eax
or eax, 0xfffffffc
add eax, 1
jne 0x40d6ae
nop dword [eax]
mov eax, dword [ebp - 0xc]
inc eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d608
dec eax
or eax, 0xfffffffc
add eax, 1
je 0x40d5f0
jmp 0x40d6ae
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d620
dec eax
or eax, 0xfffffffc
add eax, 1
je 0x40d65d
mov ecx, dword [ebp - 0xc]
lea eax, [esi + 3]
add ecx, 2
imul ecx, eax
mov dword [ebp - 0xc], ecx
mov eax, dword [ebp - 0xc]
test al, 1
jne 0x40d6ae
mov ecx, 5
nop dword [eax]
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d650
dec eax
jmp 0x40d651
inc eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
test al, 1
je 0x40d640
jmp 0x40d6ae
mov eax, dword [ebp - 0xc]
mov ecx, 5
cdq
idiv ecx
test edx, edx
je 0x40d6ae
mov eax, dword [ebp - 0xc]
lea ecx, [esi + 0x17]
add eax, 0xb
cdq
idiv ecx
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
cdq
idiv ebx
test edx, edx
jne 0x40d6ae
mov ecx, 5
nop word [eax + eax]
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d6a0
inc eax
jmp 0x40d6a1
dec eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
cdq
idiv ebx
test edx, edx
je 0x40d690
mov ebx, dword [ebp - 0x10]
mov ecx, 0x40
lea edx, [ebx + 0x218]
mov eax, edx
nop
mov byte [eax], 0
lea eax, [eax + 1]
sub ecx, 1
jne 0x40d6c0
mov ecx, edi
mov eax, dword [ecx]
mov dword [edx + 0x10], eax
mov eax, dword [ecx + 4]
mov dword [edx + 0x14], eax
mov eax, dword [ecx + 8]
mov dword [edx + 0x18], eax
mov eax, dword [ecx + 0xc]
mov dword [edx + 0x1c], eax
mov eax, dword [ecx + 0x10]
mov dword [edx + 0x20], eax
mov eax, dword [ecx + 0x14]
mov dword [edx + 0x24], eax
mov eax, dword [ecx + 0x18]
mov dword [edx + 0x28], eax
mov eax, dword [ecx + 0x1c]
mov dword [edx + 0x2c], eax
mov dword [edx], 0x61707865
mov dword [edx + 4], 0x3320646e
mov dword [edx + 8], 0x79622d32
mov dword [edx + 0xc], 0x6b206574
mov edx, 8
mov dword [ebx + 0x248], 0
mov dword [ebx + 0x24c], 0
mov eax, dword [esi]
mov dword [ebx + 0x250], eax
mov eax, dword [esi + 4]
mov dword [ebx + 0x254], eax
add ebx, 0x280
mov ecx, ebx
nop dword [eax]
mov eax, dword [edi]
lea edi, [edi + 4]
mov dword [ecx], eax
lea ecx, [ecx + 4]
sub edx, 1
jne 0x40d750
mov edi, dword [ebp - 0x10]
mov edx, 2
lea ecx, [edi + 0x2a0]
nop dword [eax]
mov eax, dword [esi]
lea esi, [esi + 4]
mov dword [ecx], eax
lea ecx, [ecx + 4]
sub edx, 1
jne 0x40d770
mov dword [ebp - 0xc], 0x62eb20
mov esi, 3
mov eax, dword [ebp - 0xc]
cdq
idiv esi
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d7d6
add eax, 2
add eax, ebx
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d7b1
dec eax
or eax, 0xfffffffc
add eax, 1
jne 0x40d86e
mov eax, dword [ebp - 0xc]
inc eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d7cf
dec eax
or eax, 0xfffffffc
add eax, 1
je 0x40d7b7
jmp 0x40d86e
mov eax, dword [ebp - 0xc]
and eax, reloc.WS2_32.dll_closesocket
jns 0x40d7e7
dec eax
or eax, 0xfffffffc
add eax, 1
je 0x40d821
mov ecx, dword [ebp - 0xc]
lea eax, [ebx + 3]
add ecx, 2
imul ecx, eax
mov dword [ebp - 0xc], ecx
mov eax, dword [ebp - 0xc]
test al, 1
jne 0x40d86e
mov ecx, 5
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d814
dec eax
jmp 0x40d815
inc eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
test al, 1
je 0x40d804
jmp 0x40d86e
mov eax, dword [ebp - 0xc]
mov ecx, 5
cdq
idiv ecx
test edx, edx
je 0x40d86e
mov eax, dword [ebp - 0xc]
lea ecx, [ebx + 0x17]
add eax, 0xb
cdq
idiv ecx
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
cdq
idiv esi
test edx, edx
jne 0x40d86e
mov ecx, 5
nop
mov eax, dword [ebp - 0xc]
cdq
idiv ecx
mov eax, dword [ebp - 0xc]
test edx, edx
je 0x40d860
inc eax
jmp 0x40d861
dec eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
cdq
idiv esi
test edx, edx
je 0x40d850
lea edx, [edi + 4]
mov ecx, edx
lea esi, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d876
sub ecx, esi
lea eax, [edi + 0x2a9]
sar ecx, 1
movzx esi, cl
add esi, esi
mov byte [edi + 0x2a8], cl
push esi
push edx
push eax
call fcn.004361e0
mov eax, dword [ebp - 8]
add esp, 0xc
inc eax
add eax, esi
mov dword [ebp - 8], eax
lea eax, [ebp - 8]
push 0x20c
push eax
push ebx
push 0
push 1
push 0
push dword [ebp - 0x1c]
call dword [sym.imp.ADVAPI32.dll_CryptEncrypt]
neg eax
pop edi
sbb eax, eax
pop esi
neg eax
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00434f21
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 4]
xor eax, eax
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00434f21
mov esp, ebp
pop ebp
ret