Fnv1a64 Class
Definition
Computes the hash for the input data using the FNV-1a 64-bit hash algorithm. This class cannot be inherited.
public sealed class Fnv1a64 : Fnv, IResumableHashAlgorithm
- Inheritance
-
Fnv1a64
- Implements
- Inherited Members
- Extension Methods
-
NonCryptographicHashAlgorithmExtensions.ComputeHash(NonCryptographicHashAlgorithm, byte[], int, int)NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, byte[], byte[])NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, byte[], string)NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, Stream, byte[])
Remarks
The FNV-1a variant XORs each input byte before multiplying by the FNV prime, improving avalanche behavior relative
to the original FNV-1 form. The 64-bit configuration uses prime 0x100000001B3 and offset basis
0xCBF29CE484222325.
Parameters at a glance.
- Output size: 64 bits (8 bytes), big-endian.
- Offset basis:
0xCBF29CE484222325. - FNV prime:
0x00000100000001B3. - Variant: FNV-1a (XOR, then multiply).
When to choose Fnv1a64. The recommended FNV variant when 32 bits would invite collisions - wider key spaces, content fingerprints, distributed cache keys. For inputs longer than ~16 bytes, MurmurHash3_128 or CityHash64 generally distribute better and run faster on modern 64-bit CPUs.
important
This algorithm is not cryptographically secure and should not be used for password hashing, digital signatures, or integrity validation in security-sensitive applications.
using Bodu.IO.Hashing;
using Bodu.IO.Hashing.Extensions;
var fnv = new Fnv1a64();
byte[] digest = fnv.ComputeHash(System.Text.Encoding.UTF8.GetBytes("user@example.com"));
Constructors
Fnv1a64()
Initializes a new instance of the Fnv1a64 class using standard FNV-1a 64-bit parameters.
public Fnv1a64()
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |