Rotr32 Add 7
#include <Windows.h>
UINT32 ImplRotateRight32(UINT32 x, UINT32 Rotate)
{
return (x >> Rotate) | (x << (32 - Rotate));
}
UINT32 HashStringRotateRight7Inc(PWCHAR String)
{
UINT32 Hash = 0;
for (; *String; String++)
{
WCHAR Index = *String;
if (Index >= 'a' && Index <= 'z')
Index -= 7;
Hash = ImplRotateRight32(Hash, 7);
Hash += (UINT8)Index;
}
return Hash;
}
INT main(VOID)
{
WCHAR StringHashExample[] = L"Hash This String";
UINT32 Hash = 0;
Hash = HashStringRotateRight7Inc(StringHashExample);
return ERROR_SUCCESS;
}Last updated