Adler-32 Checksum

Calculate the Adler-32 checksum of UTF-8 text using the modulo-65521 rolling sums used by formats such as zlib.

Description

Calculate the Adler-32 checksum of UTF-8 text using the two modulo-65521 running sums defined for zlib.

Adler-32 is a fast non-cryptographic checksum. It maintains two 16-bit sums rather than performing polynomial division: one accumulates byte values and the other accumulates the first sum. The combined result is displayed as eight uppercase hexadecimal digits.1

When to use Adler-32 Checksum

Use Adler-32 when a zlib-related stream, protocol, file structure, or test vector explicitly calls for it. It is inexpensive to compute and is intended to reveal accidental corruption.

How Adler-32 Checksum works

The first sum starts at 1 and the second at 0. For each UTF-8 byte, the byte is added to the first sum and the new first sum is added to the second; both are reduced modulo the prime 65521. The second sum becomes the high 16 bits and the first sum the low 16 bits.2, 1

How the Adler-32 function processes input

  1. Encode the entered text as UTF-8 bytes.
  2. Set s1 to 1 and s2 to 0.
  3. For each byte, update s1 = (s1 + byte) mod 65521 and s2 = (s2 + s1) mod 65521.
  4. Return s2 × 65536 + s1 as eight hexadecimal digits.

Limitations and assumptions

  • Adler-32 is not cryptographic and an attacker can deliberately preserve or replace it.
  • Short messages can exercise a relatively small portion of the checksum space.
  • The tool checks UTF-8 bytes; checksumming an already compressed file requires a byte/file-oriented surface instead.

Alternative or Complementary approaches

Use CRC-32 when a format specifies CRC-32 or stronger accidental-error coverage is desired. Use SHA-256, HMAC, or a signature when adversarial changes are relevant.

References

  1. Encoding Standard — WHATWG

  2. RFC 1950: ZLIB Compressed Data Format Specification version 3.3 — RFC Editor

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies