ComponentUtilitiesGetHashCodeDeterministic Method
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.
Namespace: Sandcastle.CoreAssembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2024.12.21.0
public static int GetHashCodeDeterministic(
this string hashString
)
<ExtensionAttribute>
Public Shared Function GetHashCodeDeterministic (
hashString As String
) As Integer
public:
[ExtensionAttribute]
static int GetHashCodeDeterministic(
String^ hashString
)
[<ExtensionAttribute>]
static member GetHashCodeDeterministic :
hashString : string -> int
- hashString String
- The string to hash
Int32The deterministic hash codeIn Visual Basic and C#, you can call this method as an instance method on any object of type
String. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
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.