Adler-32 is a checksum algorithm invented by Mark Adler for the zlib compression library. It trades a little error-detection strength for speed, and appears as the trailing integrity check in every zlib-wrapped DEFLATE stream. This tool computes it over the UTF-8 bytes of your text.
How it works
Adler-32 maintains two 16-bit running sums, both taken modulo the prime 65521:
A = 1, B = 0
for each byte b:
A = (A + b) mod 65521
B = (B + A) mod 65521
result = (B << 16) | A
Sum A is a simple running total of the byte values; sum B is a running total of all the intermediate A values, which makes the result sensitive to byte order, not just the multiset of bytes. The 32-bit output packs B into the high 16 bits and A into the low 16 bits.
Tips and notes
- The string
"Wikipedia"produces the Adler-3211E60398, a common reference value. - Because A and B are only mixed by addition, Adler-32 is comparatively weak on very short inputs — many tiny messages share checksums. CRC-32 is stronger there.
- The modulus 65521 is prime, which is what keeps the sums from collapsing into predictable patterns.
- As with any checksum, encoding matters: the result is over the UTF-8 bytes, so non-ASCII characters expand to multiple bytes before being summed.