Aesop.Fnv1a
2.0.0.1
dotnet add package Aesop.Fnv1a --version 2.0.0.1
NuGet\Install-Package Aesop.Fnv1a -Version 2.0.0.1
<PackageReference Include="Aesop.Fnv1a" Version="2.0.0.1" />
<PackageVersion Include="Aesop.Fnv1a" Version="2.0.0.1" />
<PackageReference Include="Aesop.Fnv1a" />
paket add Aesop.Fnv1a --version 2.0.0.1
#r "nuget: Aesop.Fnv1a, 2.0.0.1"
#:package Aesop.Fnv1a@2.0.0.1
#addin nuget:?package=Aesop.Fnv1a&version=2.0.0.1
#tool nuget:?package=Aesop.Fnv1a&version=2.0.0.1
FNV-1a
FNV-1a hash algorithm in C#
This small project is an implementation of the FNV-1a hash algorithm for 32-, 64-, 128-, 256-, 512- and 1024-bit variants. All implemented classes descend from the System.IO.Hashing's NonCryptographicHashAlgorithm, which should make for easy adoption.
Example:
namespace Fnv1aTest
{
using System;
using System.Globalization;
using System.IO.Hashing;
using System.Text;
using Fnv1a;
public static class Program
{
public static void Main()
{
NonCryptographicHashAlgorithm alg = new Fnv1a64();
alg.Append(Encoding.UTF8.GetBytes("foobar"));
Console.WriteLine(((ulong)BitConverter.ToInt64(alg.GetCurrentHash(), 0)).ToString("X8", CultureInfo.InvariantCulture));
}
}
}
This will output 85944171F73967E8 as the FNV-1A 64-bit hash of the string "foobar".
Special thanks to crookseta for the missing-values project which allowed for the 256- and 512-bit variants to not have to use BigInteger, which was very slow.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MissingValues (>= 2.1.4)
- System.IO.Hashing (>= 9.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.