mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-16 08:26:46 +01:00
* Fix construction of path in OpenApiParser (#1265) * Server-Sent Events (#1269) * Server Side Events * fixes * await HandleSseStringAsync(responseMessage, response, bodyData); * 1.7.5-preview-01 * IBlockingQueue * 1.7.5-preview-02 (03 April 2025) * IBlockingQueue * ... * Support OpenApi V31 (#1279) * Support OpenApi V31 * Update src/WireMock.Net.OpenApiParser/Extensions/OpenApiSchemaExtensions.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fx --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add ProtoDefinitionHelper.FromDirectory (#1263) * Add ProtoDefinitionHelper.FromDirectory * . * unix-windows * move test * imports in the proto files indeed should use a forward slash * updates * . * private Func<IdOrTexts> ProtoDefinitionFunc() * OpenTelemetry * . * fix path utils --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
31 lines
857 B
C#
31 lines
857 B
C#
using System.Globalization;
|
|
|
|
namespace WireMock.Extensions;
|
|
|
|
internal static class StringExtensions
|
|
{
|
|
// See https://andrewlock.net/why-is-string-gethashcode-different-each-time-i-run-my-program-in-net-core/
|
|
public static string GetDeterministicHashCodeAsString(this string str)
|
|
{
|
|
unchecked
|
|
{
|
|
int hash1 = (5381 << 16) + 5381;
|
|
int hash2 = hash1;
|
|
|
|
for (int i = 0; i < str.Length; i += 2)
|
|
{
|
|
hash1 = ((hash1 << 5) + hash1) ^ str[i];
|
|
if (i == str.Length - 1)
|
|
{
|
|
break;
|
|
}
|
|
|
|
hash2 = ((hash2 << 5) + hash2) ^ str[i + 1];
|
|
}
|
|
|
|
int result = hash1 + hash2 * 1566083941;
|
|
|
|
return result.ToString(CultureInfo.InvariantCulture).Replace('-', '_');
|
|
}
|
|
}
|
|
} |