Table of Contents

Adler32 Class

Definition

Namespace
Bodu.IO.Hashing.Checksums
Assembly
Bodu.IO.Hashing.dll
Package
Bodu.IO.Hashing 1.0.0
Source
Adler.Adler32.cs

Computes the zlib-compatible Adler-32 checksum of the input data using the standard modulus 65521. This class cannot be inherited.

public sealed class Adler32 : Adler32Base, IResumableHashAlgorithm
Inheritance
Adler32
Implements
Inherited Members
Extension Methods

Remarks

Adler-32 is a non-cryptographic checksum algorithm developed by Mark Adler for the zlib compression library. It produces a 32-bit checksum by maintaining two running sums (A and B) and combining them as (B << 16) | A, using the modulus 65521 (the largest prime less than 216).

Parameters at a glance.

  • Output size: 32 bits (4 bytes).
  • Modulus: 65521 (largest prime < 216).
  • Specification: zlib (RFC 1950); standard for deflate / PNG chunk integrity.

When to choose Adler32. The right choice whenever interoperability with zlib, deflate, gzip, or PNG is required - every Adler-32 produced or consumed by those formats is bit-identical to this class's output. Faster than CRC at the cost of weaker error coverage; pick Crc with CRC32_ISOHDLC when error-detection guarantees matter more than throughput, and Adler64 for very large inputs where the Adler-32 collision floor becomes a concern.

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.Checksums;
using Bodu.IO.Hashing.Extensions;

// zlib-compatible Adler-32 of a deflate payload.
var adler = new Adler32();
byte[] checksum = adler.ComputeHash(deflateBlock);

Constructors

Adler32()

Initializes a new instance of the Adler32 class using the standard Adler-32 modulus (65521).

public Adler32()

Applies to

ProductVersions
.NET8, 10

See Also