You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The *p++ increment happens before the hash calculation, so when *p is referenced inside the loop, Its actually looking at the character after the one that was just tested.
This means:
The first character of the string is never hashed
We are hashing one character past where we should be (potentially garbage memory after the null terminator)
Any two UTF‑8 strings that only differ in their initial character (e.g., "abc" vs. "xbc") will therefore produce identical hash values and single‑character strings hash to zero.
mono/mono/eglib/ghashtable.c
Lines 676 to 680 in 0f53e9e
The
*p++increment happens before the hash calculation, so when*pis referenced inside the loop, Its actually looking at the character after the one that was just tested.This means:
Any two UTF‑8 strings that only differ in their initial character (e.g., "abc" vs. "xbc") will therefore produce identical hash values and single‑character strings hash to zero.