Create HashStringUnknownGenericHash1.cpp

This commit is contained in:
vxunderground 2022-07-14 22:31:42 -05:00 committed by GitHub
parent 449f7a0119
commit 4705e3fa53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,39 @@
INT HashStringUnknownGenericHash1A(PCHAR String)
{
PCHAR Pointer;
INT Generic;
INT Hash = 0;
for (Pointer = String; *Pointer != '\0'; Pointer++)
{
Hash = (Hash << 4) + (INT)(*Pointer);
Generic = Hash & 0xF0000000L;
if (Generic != 0)
Hash = Hash ^ (Generic >> 24);
Hash = Hash & ~Generic;
}
return Hash;
}
INT HashStringUnknownGenericHash1W(PWCHAR String)
{
PWCHAR Pointer;
INT Generic;
INT Hash = 0;
for (Pointer = String; *Pointer != '\0'; Pointer++)
{
Hash = (Hash << 4) + (INT)(*Pointer);
Generic = Hash & 0xF0000000L;
if (Generic != 0)
Hash = Hash ^ (Generic >> 24);
Hash = Hash & ~Generic;
}
return Hash;
}