Package adler32

import "hash/adler32"
Overview
Index

Overview ▾

软件包adler32实现了Adler-32校验和.

在RFC 1950中定义:

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

Constants

Adler-32校验和的大小(以字节为单位).

const Size = 4

func Checksum

func Checksum(data []byte) uint32

Checksum返回Adler-32数据的校验和.

func New

func New() hash.Hash32

New返回一个新的hash.Hash32计算Adler-32校验和. 它的Sum方法将按big-endian字节顺序排列值. 返回的Hash32还实现了encoding.BinaryMarshaler和encoding.BinaryUnmarshaler来封送和取消封送哈希的内部状态.

by  ICOPY.SITE