mirror of
https://github.com/vxunderground/VX-API
synced 2024-06-26 00:38:33 +00:00
Create HashStringJenkinsOneAtATime32Bit.cpp
This commit is contained in:
parent
ff055b5b50
commit
cc9b0fdf2f
@ -0,0 +1,39 @@
|
||||
UINT32 HashStringJenkinsOneAtATime32BitA(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(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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user