Files
vxunderground-VX-API/VX-API/HashStringJenkinsOneAtATime32Bit.cpp
T
vxunderground f0b5d2bd5d Function renames, code base refactor
Some function names renamed to avoid confusion, some function annotations added.
2022-09-13 06:16:55 -05:00

41 lines
669 B
C++

#include "Win32Helper.h"
UINT32 HashStringJenkinsOneAtATime32BitA(_In_ PCHAR String)
{
SIZE_T Index = 0;
UINT32 Hash = 0;
SIZE_T Length = StringLengthA(String);
while (Index != Length)
{
Hash += String[Index++];
Hash += Hash << 10;
Hash ^= Hash >> 6;
}
Hash += Hash << 3;
Hash ^= Hash >> 11;
Hash += Hash << 15;
return Hash;
}
UINT32 HashStringJenkinsOneAtATime32BitW(_In_ PWCHAR String)
{
SIZE_T Index = 0;
UINT32 Hash = 0;
SIZE_T Length = StringLengthW(String);
while (Index != Length)
{
Hash += String[Index++];
Hash += Hash << 10;
Hash ^= Hash >> 6;
}
Hash += Hash << 3;
Hash ^= Hash >> 11;
Hash += Hash << 15;
return Hash;
}