Migrated build script to C# (#401)
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, deb) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2025-04-14 19:29:56 +02:00
1 parent 3fc15d9789
commit c715b38f41
20 files changed
+1007 -411

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
// ReSharper disable MemberCanBePrivate.Global
namespace SharedTools;
/// <summary>
/// Implements the Fowler–Noll–Vo hash function for 32-bit and 64-bit hashes.
/// </summary>
public static class FNVHash
{
private const uint FNV_OFFSET_BASIS_32_BIT = 2_166_136_261;
private const ulong FNV_OFFSET_BASIS_64_BIT = 14_695_981_039_346_656_037;
private const uint FNV_PRIME_32_BIT = 16_777_619;
private const ulong FNV_PRIME_64_BIT = 1_099_511_628_211;
/// <summary>
/// Computes the 32bit FNV-1a hash of a string.
/// </summary>
/// <param name="text">The string to hash.</param>
/// <returns>The 32bit FNV-1a hash of the string.</returns>
public static uint ToFNV32(this string text) => ToFNV32(text.AsSpan());
/// <summary>
/// Computes the 32bit FNV-1a hash of a string.
/// </summary>
/// <param name="text">The string to hash.</param>
/// <returns>The 32bit FNV-1a hash of the string.</returns>
public static uint ToFNV32(this ReadOnlySpan<char> text)
{
var hash = FNV_OFFSET_BASIS_32_BIT;
foreach (var c in text)
{
hash ^= c;
hash *= FNV_PRIME_32_BIT;
}
return hash;
}
/// <summary>
/// Computes the 64bit FNV-1a hash of a string.
/// </summary>
/// <param name="text">The string to hash.</param>
/// <returns>The 64bit FNV-1a hash of the string.</returns>
public static ulong ToFNV64(this string text) => ToFNV64(text.AsSpan());
/// <summary>
/// Computes the 64bit FNV-1a hash of a string.
/// </summary>
/// <param name="text">The string to hash.</param>
/// <returns>The 64bit FNV-1a hash of the string.</returns>
public static ulong ToFNV64(this ReadOnlySpan<char> text)
{
var hash = FNV_OFFSET_BASIS_64_BIT;
foreach (var c in text)
{
hash ^= c;
hash *= FNV_PRIME_64_BIT;
}
return hash;
}
}
+10
View File
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>