crc64

Imports

Imports #

"errors"
"hash"
"internal/byteorder"
"sync"

Constants & Variables

ECMA const #

The ECMA polynomial, defined in ECMA 182.

const ECMA = 0xC96C5795D7870F42

ISO const #

The ISO polynomial, defined in ISO 3309 and used in HDLC.

const ISO = 0xD800000000000000

Size const #

The size of a CRC-64 checksum in bytes.

const Size = 8

buildSlicing8TablesOnce var #

var buildSlicing8TablesOnce = *ast.CallExpr

magic const #

const magic = "crc\x02"

marshaledSize const #

const marshaledSize = *ast.BinaryExpr

slicing8TableECMA var #

var slicing8TableECMA *[8]Table

slicing8TableISO var #

var slicing8TableISO *[8]Table

Type Aliases

Table type #

Table is a 256-word table representing the polynomial for efficient processing.

type Table [256]uint64

Structs

digest struct #

digest represents the partial evaluation of a checksum.

type digest struct {
crc uint64
tab *Table
}

Functions

AppendBinary method #

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

BlockSize method #

func (d *digest) BlockSize() int

Checksum function #

Checksum returns the CRC-64 checksum of data using the polynomial represented by the [Table].

func Checksum(data []byte, tab *Table) uint64

MakeTable function #

MakeTable returns a [Table] constructed from the specified polynomial. The contents of this [Table] must not be modified.

func MakeTable(poly uint64) *Table

MarshalBinary method #

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

New function #

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.Hash64

Reset method #

func (d *digest) Reset()

Size method #

func (d *digest) Size() int

Sum method #

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

Sum64 method #

func (d *digest) Sum64() uint64

UnmarshalBinary method #

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

Update function #

Update returns the result of adding the bytes in p to the crc.

func Update(crc uint64, tab *Table, p []byte) uint64

Write method #

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

buildSlicing8Tables function #

func buildSlicing8Tables()

makeSlicingBy8Table function #

func makeSlicingBy8Table(t *Table) *[8]Table

makeTable function #

func makeTable(poly uint64) *Table

tableSum function #

tableSum returns the ISO checksum of table t.

func tableSum(t *Table) uint64

update function #

func update(crc uint64, tab *Table, p []byte) uint64

Generated with Arrow