-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathHasher.c
63 lines (40 loc) · 1.94 KB
/
Hasher.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <Windows.h>
#include <stdio.h>
#define SEED 0x07
#define NAME "_StrHashed"
SIZE_T StringLengthA(LPCSTR String)
{
LPCSTR String2;
for (String2 = String; *String2; ++String2);
return (String2 - String);
}
UINT32 HashStringRotr32SubA(UINT32 Value, UINT Count)
{
DWORD Mask = (CHAR_BIT * sizeof(Value) - 1);
Count &= Mask;
#pragma warning( push )
#pragma warning( disable : 4146)
return (Value >> Count) | (Value << ((-Count) & Mask));
#pragma warning( pop )
}
INT HashStringRotr32A(PCHAR String)
{
INT Value = 0;
for (INT Index = 0; Index < StringLengthA(String); Index++)
Value = String[Index] + HashStringRotr32SubA(Value, SEED);
return Value;
}
int main() {
printf("#define %s%s \t0x%0.8X \n", "NtAllocateVirtualMemory", NAME, HashStringRotr32A("NtAllocateVirtualMemory"));
printf("#define %s%s \t0x%0.8X \n", "NtProtectVirtualMemory", NAME, HashStringRotr32A("NtProtectVirtualMemory"));
printf("#define %s%s \t0x%0.8X \n", "NtCreateSection", NAME, HashStringRotr32A("NtCreateSection"));
printf("#define %s%s \t0x%0.8X \n", "NtOpenSection", NAME, HashStringRotr32A("NtOpenSection"));
printf("#define %s%s \t0x%0.8X \n", "NtMapViewOfSection", NAME, HashStringRotr32A("NtMapViewOfSection"));
printf("#define %s%s \t0x%0.8X \n", "NtUnmapViewOfSection", NAME, HashStringRotr32A("NtUnmapViewOfSection"));
printf("#define %s%s \t0x%0.8X \n", "NtClose", NAME, HashStringRotr32A("NtClose"));
printf("#define %s%s \t0x%0.8X \n", "NtQuerySystemInformation", NAME, HashStringRotr32A("NtQuerySystemInformation"));
printf("#define %s%s \t0x%0.8X \n", "NtCreateUserProcess", NAME, HashStringRotr32A("NtCreateUserProcess"));
printf("#define %s%s \t0x%0.8X \n", "NtWriteVirtualMemory", NAME, HashStringRotr32A("NtWriteVirtualMemory"));
//printf("#define %s%s \t0x%0.8X \n", "", NAME, HashStringRotr32A(""));
return 0;
}