Function at 0x402f70
Capabilities:
Authenticate hmac
Encode data using xor
Hash data via wincrypt

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0xd18
mov ebx, edx
test r8d, r8d
mov dword [rsp + 0xd70], r8d
mov r12, rcx
sete dl
test ebx, ebx
mov r14d, r9d
mov qword [rsp + 0x78], 0
sete al
mov dword [rsp + 0x6c], 0
mov qword [rsp + 0x80], 0
or dl, al
jne 0x403909
test rcx, rcx
je 0x403909
mov ecx, dword [rsp + 0xd98]
xor r8d, r8d
test ecx, ecx
je 0x4037e7
cmp qword [rsp + 0xda0], 0
je 0x403909
cmp ebx, 0x280
ja 0x403909
mov dword [rsp + 0x70], 4
mov r13, qword [sym.imp.ADVAPI32.dll_CryptGetHashParam]
lea r9, [rsp + 0x70]
mov rcx, r12
mov dword [rsp + 0x20], 0
lea r8, [rsp + 0x6c]
mov edx, 4
call r13
test eax, eax
je 0x403909
cmp dword [rsp + 0x6c], 0x280
ja 0x403909
lea rdi, [rsp + 0xaa0]
xor eax, eax
mov ecx, 0x4e
mov qword [rsp + 0xa90], 0
rep stosq qword [rdi], rax
mov qword [rsp + 0xa98], 0
mov dword [rsp + 0x590], 0
mov qword [rsp + 0x810], 0
cmp ebx, r14d
jae 0x4037fe
mov rax, qword [sym.imp.ADVAPI32.dll_CryptDuplicateHash]
mov rcx, r12
xor r8d, r8d
xor edx, edx
lea rsi, [rsp + 0x810]
mov qword [rsp + 0x38], rax
mov r9, rsi
call rax
mov rcx, qword [rsp + 0x810]
test eax, eax
je 0x40394a
test rcx, rcx
je 0x403961
xor r9d, r9d
mov rdx, qword [rsp + 0xd80]
mov r8d, r14d
call qword [sym.imp.ADVAPI32.dll_CryptHashData]
test eax, eax
je 0x4039be
lea rax, [rsp + 0x590]
lea rbp, [rsp + 0xa90]
mov dword [rsp + 0x590], 0x280
mov rcx, qword [rsp + 0x810]
mov qword [rsp + 0x30], rax
mov r9, rax
mov r8, rbp
mov edx, 2
mov dword [rsp + 0x20], 0
call r13
test eax, eax
je 0x4039cd
mov r8, qword [rsp + 0x810]
lea r14, [rsp + 0x310]
mov rdi, r14
cmp ebx, 8
jb 0x40314b
movabs rax, 0x5c5c5c5c5c5c5c5c
mov ecx, ebx
shr ecx, 3
rep stosq qword [rdi], rax
test bl, 4
je 0x40315a
mov dword [rdi], 0x5c5c5c5c
add rdi, 4
test bl, 2
je 0x40316c
mov edx, 0x5c5c
add rdi, 2
mov word [rdi - 2], dx
test bl, 1
je 0x403174
mov byte [rdi], 0x5c
lea r15, [rsp + 0x90]
mov rdi, r15
cmp ebx, 8
jb 0x403196
movabs rax, 0x3636363636363636
mov ecx, ebx
shr ecx, 3
rep stosq qword [rdi], rax
test bl, 4
je 0x4031a5
mov dword [rdi], 0x36363636
add rdi, 4
test bl, 2
je 0x4031b7
mov eax, 0x3636
add rdi, 2
mov word [rdi - 2], ax
test bl, 1
je 0x4031bf
mov byte [rdi], 0x36
test ebx, ebx
mov r10d, 1
cmovne r10d, ebx
cmp ebx, 0xf
jbe 0x403914
mov r9d, r10d
mov rax, r15
mov rcx, rbp
shr r9d, 4
mov rdx, r14
sub r9d, 1
shl r9, 4
lea r9, [rsp + r9 + 0xa0]
nop dword [rax]
movdqa xmm0, xmmword [rcx]
movdqa xmm1, xmmword [rax]
add rax, 0x10
add rcx, 0x10
add rdx, 0x10
pxor xmm1, xmm0
pxor xmm0, xmmword [rdx - 0x10]
movaps xmmword [rax - 0x10], xmm1
movaps xmmword [rdx - 0x10], xmm0
cmp rax, r9
jne 0x4031f8
mov eax, r10d
and eax, 0xfffffff0
and r10d, 0xf
je 0x4033b0
mov edx, eax
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 1]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 2]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 3]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 4]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 5]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 6]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 7]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 8]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 9]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 0xa]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 0xb]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 0xc]
cmp ebx, edx
jbe 0x4033b0
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
lea edx, [rax + 0xd]
cmp ebx, edx
jbe 0x4033b0
add eax, 0xe
movzx ecx, byte [rsp + rdx + 0xa90]
xor byte [r15 + rdx], cl
xor byte [r14 + rdx], cl
cmp ebx, eax
jbe 0x4033b0
movzx edx, byte [rsp + rax + 0xa90]
xor byte [r15 + rax], dl
xor byte [r14 + rax], dl
nop word [rax + rax]
test r8, r8
jne 0x4038e3
mov rdi, rbp
mov ecx, 0x280
xor eax, eax
rep stosb byte [rdi], al
mov rax, qword [sym.imp.ADVAPI32.dll_CryptDestroyHash]
mov dword [rsp + 0x54], 1
mov rdi, r14
mov qword [rsp + 0x40], r15
mov qword [rsp + 0x58], rax
mov eax, dword [rsp + 0x54]
mov r13, qword [rsp + 0x80]
lea r9, [rsp + 0x78]
bswap eax
mov dword [rsp + 0x74], eax
test r13, r13
jne 0x403492
mov rcx, r12
mov rax, qword [rsp + 0x38]
xor r8d, r8d
xor edx, edx
mov qword [rsp + 0x88], 0
lea r9, [rsp + 0x88]
call rax
mov rcx, qword [rsp + 0x88]
test eax, eax
je 0x403923
test rcx, rcx
je 0x403923
xor r9d, r9d
mov rdx, qword [rsp + 0x40]
mov r14, qword [sym.imp.ADVAPI32.dll_CryptHashData]
mov r8d, ebx
call r14
test eax, eax
je 0x40391b
mov r13, qword [rsp + 0x88]
mov qword [rsp + 0x78], r13
test r13, r13
je 0x40348a
mov rcx, r13
mov r8d, dword [rsp + 0xd88]
mov rdx, qword [rsp + 0xd90]
xor r9d, r9d
call r14
mov r13, qword [rsp + 0x78]
lea r9, [rsp + 0x80]
xor r8d, r8d
xor edx, edx
mov rax, qword [rsp + 0x38]
mov rcx, r13
call rax
test eax, eax
je 0x403937
mov rcx, qword [rsp + 0x78]
test rcx, rcx
je 0x4034c7
lea rdx, [rsp + 0x74]
xor r9d, r9d
mov r8d, 4
call qword [sym.imp.ADVAPI32.dll_CryptHashData]
mov qword [rsp + 0x20], rbp
lea r14, [rsp + 0x78]
mov r9d, ebx
mov r8, rdi
mov rdx, r14
mov rcx, r12
call fcn.00402e30
test eax, eax
jne 0x403780
mov r8d, dword [rsp + 0x6c]
mov rcx, qword [rsp + 0x30]
mov rdx, rbp
mov r13, r8
call sub.msvcrt.dll_memcpy
cmp dword [rsp + 0xd70], 1
jbe 0x403732
lea rax, [rsp + 0x88]
mov r15, qword [sym.imp.ADVAPI32.dll_CryptHashData]
mov r13d, 1
mov qword [rsp + 0x48], rax
nop word [rax + rax]
mov rcx, r12
mov r9, qword [rsp + 0x48]
mov rax, qword [rsp + 0x38]
xor r8d, r8d
mov qword [rsp + 0x88], 0
xor edx, edx
call rax
mov rcx, qword [rsp + 0x88]
test eax, eax
je 0x403870
test rcx, rcx
je 0x403870
mov rdx, qword [rsp + 0x40]
xor r9d, r9d
mov r8d, ebx
call r15
mov rcx, qword [rsp + 0x88]
test eax, eax
je 0x403870
mov qword [rsp + 0x78], rcx
mov r8d, dword [rsp + 0x6c]
test rcx, rcx
je 0x40359f
xor r9d, r9d
mov rdx, rbp
call r15
mov qword [rsp + 0x20], rsi
mov r9d, ebx
mov r8, rdi
mov rdx, r14
mov rcx, r12
call fcn.00402e30
test eax, eax
jne 0x403780
mov r8d, dword [rsp + 0x6c]
test r8d, r8d
je 0x403710
lea eax, [r8 - 1]
cmp eax, 0xe
jbe 0x403860
lea r9d, [r8 - 0x10]
mov rax, qword [rsp + 0x30]
mov rcx, rsi
xor edx, edx
shr r9d, 4
add r9d, 1
nop
movdqa xmm0, xmmword [rax]
pxor xmm0, xmmword [rcx]
add edx, 1
add rcx, 0x10
add rax, 0x10
movaps xmmword [rax - 0x10], xmm0
cmp edx, r9d
jb 0x4035f0
shl r9d, 4
mov rax, qword [rsp + 0x30]
mov ecx, r8d
mov edx, r9d
sub ecx, r9d
add rax, rdx
add rdx, rsi
cmp r8d, r9d
je 0x403710
movzx r9d, byte [rdx]
xor byte [rax], r9b
cmp ecx, 1
je 0x403710
movzx r9d, byte [rdx + 1]
xor byte [rax + 1], r9b
cmp ecx, 2
je 0x403710
movzx r9d, byte [rdx + 2]
xor byte [rax + 2], r9b
cmp ecx, 3
je 0x403710
movzx r9d, byte [rdx + 3]
xor byte [rax + 3], r9b
cmp ecx, 4
je 0x403710
movzx r9d, byte [rdx + 4]
xor byte [rax + 4], r9b
cmp ecx, 5
je 0x403710
movzx r9d, byte [rdx + 5]
xor byte [rax + 5], r9b
cmp ecx, 6
je 0x403710
movzx r9d, byte [rdx + 6]
xor byte [rax + 6], r9b
cmp ecx, 7
je 0x403710
movzx r9d, byte [rdx + 7]
xor byte [rax + 7], r9b
cmp ecx, 8
je 0x403710
movzx r9d, byte [rdx + 8]
xor byte [rax + 8], r9b
cmp ecx, 9
je 0x403710
movzx r9d, byte [rdx + 9]
xor byte [rax + 9], r9b
cmp ecx, 0xa
je 0x403710
movzx r9d, byte [rdx + 0xa]
xor byte [rax + 0xa], r9b
cmp ecx, 0xb
je 0x403710
movzx r9d, byte [rdx + 0xb]
xor byte [rax + 0xb], r9b
cmp ecx, 0xc
je 0x403710
movzx r9d, byte [rdx + 0xc]
xor byte [rax + 0xc], r9b
cmp ecx, 0xd
je 0x403710
movzx r9d, byte [rdx + 0xd]
xor byte [rax + 0xd], r9b
cmp ecx, 0xe
je 0x403710
movzx edx, byte [rdx + 0xe]
xor byte [rax + 0xe], dl
nop word [rax + rax]
mov rdx, rsi
mov rcx, rbp
add r13d, 1
call sub.msvcrt.dll_memcpy
cmp dword [rsp + 0xd70], r13d
jne 0x403530
mov r13d, dword [rsp + 0x6c]
cmp r13d, dword [rsp + 0xd98]
ja 0x403994
mov r14d, r13d
mov rdx, qword [rsp + 0x30]
mov rcx, qword [rsp + 0xda0]
mov r8, r14
call sub.msvcrt.dll_memcpy
add qword [rsp + 0xda0], r14
add dword [rsp + 0x54], 1
sub dword [rsp + 0xd98], r13d
jne 0x4033e1
mov r15, qword [rsp + 0x40]
mov r14, rdi
xor r8d, r8d
jmp 0x40378b
mov r15, qword [rsp + 0x40]
mov r8d, eax
mov r14, rdi
mov edx, 0x280
xor eax, eax
mov rdi, r15
mov rcx, rdx
rep stosb byte [rdi], al
mov rdi, r14
mov rcx, rdx
rep stosb byte [rdi], al
mov rdi, qword [rsp + 0x30]
mov rcx, rdx
rep stosb byte [rdi], al
mov rdi, rsi
mov rcx, rdx
rep stosb byte [rdi], al
mov rdi, rbp
mov rcx, rdx
rep stosb byte [rdi], al
mov rcx, qword [rsp + 0x78]
test rcx, rcx
jne 0x4038ce
mov rcx, qword [rsp + 0x80]
test rcx, rcx
je 0x4037e7
mov dword [rsp + 0x30], r8d
call qword [sym.imp.ADVAPI32.dll_CryptDestroyHash]
mov r8d, dword [rsp + 0x30]
mov eax, r8d
add rsp, 0xd18
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
lea rbp, [rsp + 0xa90]
mov rsi, qword [rsp + 0xd80]
mov rdi, rbp
cmp r14d, 8
jae 0x4038b7
xor eax, eax
test r14b, 4
jne 0x4038a2
test r14b, 2
jne 0x40388e
test r14b, 1
jne 0x403885
mov rax, qword [sym.imp.ADVAPI32.dll_CryptDuplicateHash]
mov dword [rsp + 0x590], r14d
xor r8d, r8d
lea rsi, [rsp + 0x810]
mov qword [rsp + 0x38], rax
lea rax, [rsp + 0x590]
mov qword [rsp + 0x30], rax
jmp 0x403129
mov rax, qword [rsp + 0x30]
mov ecx, r8d
mov rdx, rsi
jmp 0x40362d
mov rax, qword [rsp + 0x58]
call rax
mov qword [rsp + 0x78], 0
jmp 0x40359f
movzx edx, byte [rsi + rax]
mov byte [rdi + rax], dl
jmp 0x40382f
movzx edx, word [rsi + rax]
mov word [rdi + rax], dx
add rax, 2
test r14b, 1
je 0x40382f
jmp 0x403885
mov eax, dword [rsi]
mov dword [rdi], eax
mov eax, 4
test r14b, 2
je 0x403829
jmp 0x40388e
mov ecx, r14d
xor eax, eax
shr ecx, 3
rep movsq qword [rdi], qword [rsi]
test r14b, 4
je 0x403823
jmp 0x4038a2
mov dword [rsp + 0x30], r8d
call qword [sym.imp.ADVAPI32.dll_CryptDestroyHash]
mov r8d, dword [rsp + 0x30]
jmp 0x4037ca
mov rcx, r8
mov rdi, rbp
call qword [sym.imp.ADVAPI32.dll_CryptDestroyHash]
mov ecx, 0x280
xor eax, eax
mov qword [rsp + 0x810], 0
rep stosb byte [rdi], al
jmp 0x4033c5
mov r8d, 0xffffffff
jmp 0x4037e7
xor eax, eax
jmp 0x403232
mov rcx, qword [rsp + 0x88]
call qword [sym.imp.ADVAPI32.dll_CryptDestroyHash]
mov qword [rsp + 0x78], 0
jmp 0x40348a
mov r15, qword [rsp + 0x40]
mov r14, rdi
mov r8d, 0xffffffff
jmp 0x40378b
test rcx, rcx
je 0x403961
call qword [sym.imp.ADVAPI32.dll_CryptDestroyHash]
mov qword [rsp + 0x810], 0
lea rbp, [rsp + 0xa90]
mov ecx, 0x280
xor eax, eax
mov rdi, rbp
rep stosb byte [rdi], al
lea rax, [rsp + 0x590]
lea r14, [rsp + 0x310]
mov qword [rsp + 0x30], rax
lea r15, [rsp + 0x90]
jmp 0x40393f
mov r8d, dword [rsp + 0xd98]
mov rdx, qword [rsp + 0x30]
mov r14, rdi
mov rcx, qword [rsp + 0xda0]
mov r15, qword [rsp + 0x40]
call sub.msvcrt.dll_memcpy
xor r8d, r8d
jmp 0x40378b
mov rcx, qword [rsp + 0x810]
test rcx, rcx
je 0x403961
jmp 0x40394f
mov rcx, qword [rsp + 0x810]
test rcx, rcx
je 0x4039ec
call qword [sym.imp.ADVAPI32.dll_CryptDestroyHash]
mov qword [rsp + 0x810], 0
mov rdi, rbp
mov ecx, 0x280
xor eax, eax
rep stosb byte [rdi], al
lea r14, [rsp + 0x310]
lea r15, [rsp + 0x90]
jmp 0x40393f