Table of Contents

Fnv1a32 Class

Definition

Namespace
Bodu.IO.Hashing
Assembly
Bodu.IO.Hashing.dll
Package
Bodu.IO.Hashing 1.0.0
Source
Fnv.Fnv1a32.cs

Computes the hash for the input data using the FNV-1a 32-bit hash algorithm. This class cannot be inherited.

public sealed class Fnv1a32 : Fnv, IResumableHashAlgorithm
Inheritance
Fnv1a32
Implements
Inherited Members
Extension Methods

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 32-bit configuration uses prime 0x01000193 and offset basis 0x811C9DC5 .

Parameters at a glance.

  • Output size: 32 bits (4 bytes), big-endian.
  • Offset basis: 0x811C9DC5.
  • FNV prime: 0x01000193.
  • Variant: FNV-1a (XOR, then multiply).

When to choose Fnv1a32. The recommended 32-bit FNV variant - better avalanche than Fnv132 at identical cost. Pick it for hash-table keying of short strings or identifiers when 32 bits is enough; reach for MurmurHash3_32 on inputs longer than ~16 bytes or when SMHasher quality matters, and for Fnv1a64 when 64 bits would meaningfully reduce collisions.

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 Fnv1a32();
byte[] digest = fnv.ComputeHash(System.Text.Encoding.UTF8.GetBytes("user@example.com"));

Constructors

Fnv1a32()

Initializes a new instance of the Fnv1a32 class using standard FNV-1a 32-bit parameters.

public Fnv1a32()

Applies to

ProductVersions
.NET8, 10