From NWN Lexicon
Jump to navigationJump to search
Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

Returns the 32bit integer hash of sString.

int HashString(
    string sString


The string from which the hash is calculated.


Returns the 32bit integer hash of sString. This hash is stable and will always have the same value for same input string, regardless of platform.

The hash algorithm is the same as the one used internally for strings in case statements, so you can do:
    switch (HashString(sString))
         case "AAA":    HandleAAA(); break;
         case "BBB":    HandleBBB(); break;

NOTE: The exact algorithm used is XXH32(sString) ^ XXH32(""). This means that HashString("") is 0.


Information icon.png This section of the article is a stub. You can help the NWN Lexicon by expanding it.


This function was added in 1.86.8193.35 of NWN:EE.


Information icon.png This article is in need of examples. You can help the NWN Lexicon by showing how to use this code effectively.

See Also

 author: Shadguy