City17
4 years
returns a string hash for the given string.
The hash is supposed to be case-insensitive of the input string: this works for ASCII and some small subset of Unicode (Latin Supplement, Cyrillic...). Also the backslash is the same as forward slash: / and \. A probable explanation for this is the usage of file paths, since the game runs on Windows and Mac OS/OSX. StringHash is also used for variable lookup: string name -> integer index.
The underlying algorithm is subject to change between major versions. The Hive: code for the old algorithm "SStrHash2" via "1997 Dr Dobbs article" and a question about the changed algorithm in Reforged. TODO: In what version was it changed?
The hash is supposed to be case-insensitive of the input string: this works for ASCII and some small subset of Unicode (Latin Supplement, Cyrillic...). Also the backslash is the same as forward slash: / and \. A probable explanation for this is the usage of file paths, since the game runs on Windows and Mac OS/OSX. StringHash is also used for variable lookup: string name -> integer index.
The underlying algorithm is subject to change between major versions. The Hive: code for the old algorithm "SStrHash2" via "1997 Dr Dobbs article" and a question about the changed algorithm in Reforged. TODO: In what version was it changed?