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.

Definition

Namespace: Sandcastle.Core
Assembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2024.9.12.0
public static int GetHashCodeDeterministic(
	this string hashString
)

Parameters

hashString  String
The string to hash

Return Value

Int32
The deterministic hash code

Usage Note

In 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).

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.

See Also