version: 1.10

package adler32

import "hash/adler32"

Overview

Package adler32 implements the Adler-32 checksum.

It is defined in RFC 1950:

  1. Adler-32 is composed of two sums accumulated per byte: s1 is
  2. the sum of all bytes, s2 is the sum of all s1 values. Both sums
  3. are done modulo 65521. s1 is initialized to 1, s2 to zero. The
  4. Adler-32 checksum is stored as s2*65536 + s1 in most-
  5. significant-byte first (network) order.

Index

Package files

adler32.go

Constants

  1. const Size = 4

The size of an Adler-32 checksum in bytes.

func Checksum

  1. func Checksum(data []byte) uint32

Checksum returns the Adler-32 checksum of data.

func New

  1. func New() hash.Hash32

New returns a new hash.Hash32 computing the Adler-32 checksum. Its Sum method
will lay the value out in big-endian byte order. The returned Hash32 also
implements encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to marshal
and unmarshal the internal state of the hash.