Function at 0x10040920
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x18
mov eax, dword [esp + 0x2c]
push ebx
mov ebx, dword [esp + 0x34]
push ebp
mov ebp, dword [esp + 0x2c]
push esi
xor esi, esi
lea ecx, [eax + ebx + 2]
cmp ebp, ecx
push edi
mov dword [esp + 0x18], ebp
mov dword [esp + 0x14], esi
mov dword [esp + 0x1c], esi
mov dword [esp + 0x10], esi
jge 0x1004095a
mov eax, 0x180f002b
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret
mov edx, dword [esp + 0x2c]
mov eax, dword [edx + 0x14]
cmp eax, esi
jne 0x10040969
xor eax, eax
jmp 0x10040986
mov edx, dword [eax + 4]
lea ecx, [edx - 1]
cmp edx, esi
jne 0x10040977
xor eax, eax
jmp 0x10040986
mov eax, dword [eax]
mov eax, dword [eax + ecx*4]
call fcn.10049f70
shl ecx, 5
add eax, ecx
mov edi, dword [esp + 0x30]
dec eax
and eax, 7
mov dword [esp + 0x24], eax
jne 0x1004099d
mov byte [edi], 0
inc edi
dec ebp
mov dword [esp + 0x18], ebp
mov ebp, dword [esp + 0x44]
cmp ebp, esi
jne 0x100409b4
mov esi, 0x180f002b
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret
mov ecx, dword [ebp]
push ecx
push ebp
call sym.inicrypto_v5.4.1.dll_ISC_Init_DIGEST
mov esi, eax
add esp, 8
test esi, esi
jne 0x10040bbf
push ebx
call fcn.10087e65
add esp, 4
mov dword [esp + 0x40], eax
test eax, eax
je 0x10040b76
push ebx
push esi
push eax
call fcn.1008e320
mov edx, dword [esp + 0x4c]
add esp, 0xc
push ebx
push edx
call sym.inicrypto_v5.4.1.dll_ISC_Rand_Bytes
mov esi, eax
add esp, 8
test esi, esi
jne 0x10040b7b
mov eax, dword [esp + 0x3c]
lea eax, [eax + ebx + 8]
push eax
mov dword [esp + 0x24], eax
call fcn.10087e65
mov esi, eax
add esp, 4
mov dword [esp + 0x1c], esi
test esi, esi
je 0x10040b76
mov ecx, dword [esp + 0x3c]
mov edx, dword [esp + 0x38]
xor eax, eax
mov dword [esi], eax
push ecx
mov dword [esi + 4], eax
push edx
lea eax, [esi + 8]
push eax
call fcn.1008d020
mov ecx, dword [esp + 0x4c]
mov edx, dword [esp + 0x48]
add esp, 0xc
push ebx
push ecx
lea eax, [esi + edx + 8]
push eax
call fcn.1008d020
mov eax, dword [ebp + 8]
add esp, 0xc
push eax
mov dword [esp + 0x40], eax
call fcn.10087e65
add esp, 4
mov dword [esp + 0x14], eax
test eax, eax
je 0x10040b76
mov ecx, dword [esp + 0x20]
push ecx
push esi
push ebp
call sym.inicrypto_v5.4.1.dll_ISC_Update_DIGEST
mov esi, eax
add esp, 0xc
test esi, esi
jne 0x10040b7b
mov eax, dword [esp + 0x14]
lea edx, [esp + 0x3c]
push edx
push eax
push ebp
call sym.inicrypto_v5.4.1.dll_ISC_Final_DIGEST
mov esi, eax
add esp, 0xc
test esi, esi
jne 0x10040b7b
mov ebp, dword [esp + 0x18]
sub ebp, dword [esp + 0x3c]
mov esi, ebp
sub esi, ebx
sub esi, 2
je 0x10040ac8
push esi
push eax
push edi
call fcn.1008e320
add esp, 0xc
mov ecx, dword [esp + 0x40]
push ebx
push ecx
lea edx, [esi + edi + 1]
push edx
mov byte [esi + edi], 1
call fcn.1008d020
add esp, 0xc
lea esi, [ebp - 1]
push esi
call fcn.10087e65
mov ebx, eax
add esp, 4
test ebx, ebx
jne 0x10040afb
mov esi, 0x180f003b
jmp 0x10040b7f
mov ecx, dword [esp + 0x3c]
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x2c]
mov eax, dword [eax]
push ecx
push edx
push esi
and eax, 0xff00ff00
push ebx
call fcn.100406f0
add esp, 0x10
test eax, eax
je 0x10040b25
mov esi, 0x180f0059
jmp 0x10040b7f
test esi, esi
jle 0x10040b3c
mov ecx, ebx
mov eax, edi
sub ecx, edi
mov ebp, esi
mov dl, byte [ecx + eax]
xor byte [eax], dl
inc eax
sub ebp, 1
jne 0x10040b31
mov eax, dword [esp + 0x3c]
mov ecx, dword [esp + 0x14]
push eax
push ecx
add esi, edi
push esi
call fcn.1008d020
mov eax, dword [esp + 0x30]
add esp, 0xc
test eax, eax
je 0x10040b69
mov ecx, 8
sub ecx, eax
mov edx, 0xff
sar edx, cl
and byte [edi], dl
mov eax, dword [esp + 0x34]
mov byte [edi + eax - 1], 0xbc
xor esi, esi
jmp 0x10040b7f
mov esi, 0x180f003b
mov ebx, dword [esp + 0x10]
mov eax, dword [esp + 0x40]
test eax, eax
je 0x10040b90
push eax
call fcn.10087d88
add esp, 4
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x10040ba1
push eax
call fcn.10087d88
add esp, 4
mov eax, dword [esp + 0x14]
test eax, eax
je 0x10040bb2
push eax
call fcn.10087d88
add esp, 4
test ebx, ebx
je 0x10040bbf
push ebx
call fcn.10087d88
add esp, 4
pop edi
mov eax, esi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret