You can find the Example of Hash under
1.3.9.1 Non-Null-Terminated Unicode String to Unsigned Integer Hash
Given a non-null-terminated Unicode string and the length of the string, a 4-byte unsigned integer hash value can be obtained by performing the following algorithm:
- Given an input string and length of the input string (cch).
- Set a 4-byte unsigned integer value nHash equal to 0x00000000.
- For each character from position 0 to the end of the input string perform the following steps.
Example:
for (i=0; ich<cch; ++ich)
nHash = (nHash<<5) + nHash + inputString[ich];
1. Set nHash, equal to itself bitwise shifted left 5 times, added unto itself, and then added to the value of the character of input string at ich.
- nHash will be stored and used again in the next iteration of the loop until the last character of input string.
- The result of the algorithm is the value nHash.
Let me know if this helped
Hung-Chun Yu
Microsoft Open Specifications Support