Adler32 Class
Definition
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
-
NonCryptographicHashAlgorithmExtensions.ComputeHash(NonCryptographicHashAlgorithm, byte[], int, int)NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, byte[], byte[])NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, byte[], string)NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, Stream, byte[])
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
| Product | Versions |
|---|---|
| .NET | 8, 10 |