Documentation ¶
Overview ¶
Package crc64 implements the 64-bit cyclic redundancy check, or CRC-64, checksum. See https://en.wikipedia.org/wiki/Cyclic_redundancy_check for information.
Polynomials are represented in LSB-first form, also known as reversed representation.
Checksums are layed out in big-endian byte order.
Index ¶
Constants ¶
const Size = 8
The size of a CRC-64 checksum in bytes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hash ¶
type Hash interface { hash.Hash64 encoding.BinaryMarshaler encoding.BinaryUnmarshaler }
Hash is a hash.Hash64 that also implements encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to marshal and unmarshal the internal state of the hash. Its Sum methods will lay the value out in big-endian byte order.
type Poly ¶
type Poly struct {
// contains filtered or unexported fields
}
Poly represents a 64-bit polynomial with tables for efficient processing.
func ECMA ¶
func ECMA() *Poly
ECMA returns the Poly representing the ECMA polynomial, defined in ECMA 182.
func ISO ¶
func ISO() *Poly
ISO returns the Poly representing the ISO polynomial, defined in ISO 3309 and used in HDLC.
func MakePoly ¶
MakePoly returns a Poly constructed from the specified polynomial given in LSB-first form, also known as reversed representation. The returned Poly may be shared and must not be modified.
func (*Poly) Combine ¶
Combine returns the result of adding n bytes with the next sum to the prev sum.
func (*Poly) Polynomial ¶
Polynomial returns the polynomial in LSB-first form, also known as reversed representation.