There was an error while loading. Please reload this page.
2 parents 0f9bfe0 + 0df94d9 commit 4a4deb0Copy full SHA for 4a4deb0
1 file changed
src/Celerity.Hashing/StringFnV1AHasher.cs
@@ -36,8 +36,9 @@ public int Hash(string key)
36
uint hash = offsetBasis;
37
foreach (char c in key)
38
{
39
- // Convert char to its lower byte; you may also want to consider
40
- // encoding specifics if you deal with non-ASCII characters.
+ // Fold only the low byte of each UTF-16 code unit. Characters that share a
+ // low byte but differ in their high byte (i.e., U+0100 and above) collide here; use
41
+ // StringFnV1AFullHasher when that distinction matters.
42
hash ^= (byte)(c & 0xFF);
43
hash *= fnvPrime;
44
}
0 commit comments