Files
vxunderground-VX-API/VX-API/HashStringRotr32.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
939 B
C++

#include "Win32Helper.h"
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(_In_ PCHAR String)
{
INT Value = 0;
for (INT Index = 0; Index < StringLengthA(String); Index++)
Value = String[Index] + HashStringRotr32SubA(Value, 7);
return Value;
}
UINT32 HashStringRotr32SubW(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 HashStringRotr32W(_In_ PWCHAR String)
{
INT Value = 0;
for (INT Index = 0; Index < StringLengthW(String); Index++)
Value = String[Index] + HashStringRotr32SubW(Value, 7);
return Value;
}