Class FowlerNollVo64
Provides an implementation of the FVN (Fowler–Noll–Vo) non-cryptographic hashing algorithm for 64-bit hash values. This class cannot be inherited. Implements the FowlerNollVoHash
public sealed class FowlerNollVo64 : FowlerNollVoHash, IHash, IConfigurable<FowlerNollVoOptions>
- Inheritance
-
FowlerNollVo64
- Implements
- Inherited Members
Examples
The following example demonstrates how to compute a 64-bit Fowler-Noll-Vo (FNV) hash using the FowlerNollVo64 class.
using System;
using System.Text;
using Cuemon.Security;
using Cuemon;
namespace MyApp.Examples;
public class FowlerNollVo64Example
{
public void Demonstrate()
{
// Create FNV-1a 64-bit hash instance (default algorithm)
var fnv = new FowlerNollVo64();
// Compute hash from a string
byte[] data = Encoding.UTF8.GetBytes("hello");
HashResult hash = fnv.ComputeHash(data);
// Display the hash in hexadecimal format
Console.WriteLine(hash.ToHexadecimalString());
// Switch to FNV-1 algorithm
fnv.Options.Algorithm = FowlerNollVoAlgorithm.Fnv1;
HashResult hashFnv1 = fnv.ComputeHash(data);
Console.WriteLine(hashFnv1.ToHexadecimalString());
// Change byte order to little endian
fnv.Options.ByteOrder = Endianness.LittleEndian;
HashResult hashLe = fnv.ComputeHash(data);
Console.WriteLine(hashLe.ToHexadecimalString());
}
}
Constructors
FowlerNollVo64(Action<FowlerNollVoOptions>)
Initializes a new instance of the FowlerNollVo64 class.
public FowlerNollVo64(Action<FowlerNollVoOptions> setup = null)
Parameters
setupAction<FowlerNollVoOptions>The FowlerNollVoOptions which may be configured.