Imports #
"errors"
"hash"
"internal/byteorder"
"sync"
"errors"
"hash"
"internal/byteorder"
"sync"
The ECMA polynomial, defined in ECMA 182.
const ECMA = 0xC96C5795D7870F42The ISO polynomial, defined in ISO 3309 and used in HDLC.
const ISO = 0xD800000000000000The size of a CRC-64 checksum in bytes.
const Size = 8var buildSlicing8TablesOnce = *ast.CallExprconst magic = "crc\x02"const marshaledSize = *ast.BinaryExprvar slicing8TableECMA *[8]Tablevar slicing8TableISO *[8]TableTable is a 256-word table representing the polynomial for efficient processing.
type Table [256]uint64digest represents the partial evaluation of a checksum.
type digest struct {
crc uint64
tab *Table
}func (d *digest) AppendBinary(b []byte) ([]byte, error)func (d *digest) BlockSize() intChecksum returns the CRC-64 checksum of data using the polynomial represented by the [Table].
func Checksum(data []byte, tab *Table) uint64MakeTable returns a [Table] constructed from the specified polynomial. The contents of this [Table] must not be modified.
func MakeTable(poly uint64) *Tablefunc (d *digest) MarshalBinary() ([]byte, error)New creates a new hash.Hash64 computing the CRC-64 checksum using the polynomial represented by the [Table]. Its Sum method will lay the value out in big-endian byte order. The returned Hash64 also implements [encoding.BinaryMarshaler] and [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal state of the hash.
func New(tab *Table) hash.Hash64func (d *digest) Reset()func (d *digest) Size() intfunc (d *digest) Sum(in []byte) []bytefunc (d *digest) Sum64() uint64func (d *digest) UnmarshalBinary(b []byte) errorUpdate returns the result of adding the bytes in p to the crc.
func Update(crc uint64, tab *Table, p []byte) uint64func (d *digest) Write(p []byte) (n int, err error)func buildSlicing8Tables()func makeSlicingBy8Table(t *Table) *[8]Tablefunc makeTable(poly uint64) *TabletableSum returns the ISO checksum of table t.
func tableSum(t *Table) uint64func update(crc uint64, tab *Table, p []byte) uint64Generated with Arrow