adler32

Imports

Imports #

"errors"
"hash"
"internal/byteorder"

Constants & Variables

Size const #

The size of an Adler-32 checksum in bytes.

const Size = 4

magic const #

const magic = "adl\x01"

marshaledSize const #

const marshaledSize = *ast.BinaryExpr

mod const #

mod is the largest prime that is less than 65536.

const mod = 65521

nmax const #

nmax is the largest n such that 255 * n * (n+1) / 2 + (n+1) * (mod-1) <= 2^32-1. It is mentioned in RFC 1950 (search for "5552").

const nmax = 5552

Type Aliases

digest type #

digest represents the partial evaluation of a checksum. The low 16 bits are s1, the high 16 bits are s2.

type digest uint32

Functions

AppendBinary method #

func (d *digest) AppendBinary(b []byte) ([]byte, error)

BlockSize method #

func (d *digest) BlockSize() int

Checksum function #

Checksum returns the Adler-32 checksum of data.

func Checksum(data []byte) uint32

MarshalBinary method #

func (d *digest) MarshalBinary() ([]byte, error)

New function #

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.

func New() hash.Hash32

Reset method #

func (d *digest) Reset()

Size method #

func (d *digest) Size() int

Sum method #

func (d *digest) Sum(in []byte) []byte

Sum32 method #

func (d *digest) Sum32() uint32

UnmarshalBinary method #

func (d *digest) UnmarshalBinary(b []byte) error

Write method #

func (d *digest) Write(p []byte) (nn int, err error)

update function #

Add p to the running checksum d.

func update(d digest, p []byte) digest

Generated with Arrow