Skip to content

adler_32

adler_32(data): number

Defined in: checksum/adler_32.ts:17

Computes the Adler-32 checksum of data (Mark Adler, used by zlib).

Two running sums mod 65521 (the largest prime below 2¹⁶), one of the bytes themselves and one of the running total of the first — weaker error detection than a CRC-32 of the same degree, but far cheaper to compute and, unlike a CRC, trivial to update incrementally as a byte leaves a fixed-size window.

Complexity: O(n) in the byte length of data.

Uint8Array

The bytes to check.

number

An unsigned 32-bit checksum, the high 16 bits holding the sum of sums and the low 16 bits holding the sum of bytes.