ComponentUtilities.GetHashCodeDeterministic Method
Definition
- Namespace
- Sandcastle.Core
- Assembly
- Sandcastle.Core.dll
This returns a deterministic hash code that is the same in the full .NET Framework and in .NET Core in every session given the same string to hash.
public static int GetHashCodeDeterministic(this string hashString)
Parameters
hashStringstringThe string to hash
Returns
- int
The deterministic hash code
Remarks
The hashing algorithm differs in .NET Core and returns different hash codes for each session. This was done for security to prevent DoS attacks. For the help file builder, we're just using it to generate a short filenames or other constant IDs. As such, we need a deterministic hash code to keep generating the same hash code for the same IDs in all sessions regardless of platform so that the filenames and other IDs stay the same for backward compatibility.