adler32

Name

adler32 -- compute Adler 32 Checksum

Synopsis

#include <zlib.h>

uLong adler32(uLong adler, const Bytef * buf, uInt len);

Description

The adler32() function shall compute a running Adler-32 checksum (as described in RFC 1950: ZLIB Compressed Data Format Specication). On entry, adler is the previous value for the checksum, and buf shall point to an array of len bytes of data to be added to this checksum. The adler32() function shall return the new checksum.

If buf is NULL (or Z_NULL), adler32() shall return the initial checksum.

Return Value

The adler32() function shall return the new checksum value.

Errors

None defined.

Application Usage (informative)

The following code fragment demonstrates typical usage of the adler32() function:

     uLong adler = adler32(0L, Z_NULL, 0);

     while (read_buffer(buffer, length) != EOF) {
       adler = adler32(adler, buffer, length);
     }
     if (adler != original_adler) error();