💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# package crc64 `import "hash/crc64"` Package crc64 implements the 64-bit cyclic redundancy check, or CRC-64, checksum. See [http://en.wikipedia.org/wiki/Cyclic_redundancy_check](http://en.wikipedia.org/wiki/Cyclic_redundancy_check) for information. ## Index * [Constants](#pkg-constants) * [type Table](#Table) * [func MakeTable(poly uint64) \*Table](#MakeTable) * [func Checksum(data []byte, tab \*Table) uint64](#Checksum) * [func Update(crc uint64, tab \*Table, p []byte) uint64](#Update) * [func New(tab \*Table) hash.Hash64](#New) ## Constants ``` const ( // ISO 3309定义的ISO多项式,用于HDLC ISO = 0xD800000000000000 // ECMA 182定义的ECMA多项式 ECMA = 0xC96C5795D7870F42 ) ``` 预定义的多项式。 ``` const Size = 8 ``` CRC-64校验和的字节数。 ## type [Table](https://github.com/golang/go/blob/master/src/hash/crc64/crc64.go#L25 "View Source") ``` type Table [256]uint64 ``` 长度256的uint64切片,代表一个用于高效运作的多项式。 ### func [MakeTable](https://github.com/golang/go/blob/master/src/hash/crc64/crc64.go#L28 "View Source") ``` func MakeTable(poly uint64) *Table ``` 返回一个代表poly指定的多项式的\*Table。 ## func [Checksum](https://github.com/golang/go/blob/master/src/hash/crc64/crc64.go#L87 "View Source") ``` func Checksum(data []byte, tab *Table) uint64 ``` 返回数据data使用tab代表的多项式计算出的CRC-64校验和。 ## func [Update](https://github.com/golang/go/blob/master/src/hash/crc64/crc64.go#L69 "View Source") ``` func Update(crc uint64, tab *Table, p []byte) uint64 ``` 返回将切片p的数据采用tab表示的多项式添加到crc之后计算出的新校验和。 ## func [New](https://github.com/golang/go/blob/master/src/hash/crc64/crc64.go#L52 "View Source") ``` func New(tab *Table) hash.Hash64 ``` 创建一个使用tab代表的多项式计算CRC-64校验和的hash.Hash64接口。