crc16

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package crc16 computes the 16 bit checksum over a series of bytes.

Index

Constants

View Source
const (
	// ANSI is the polynomial x16+x15+x2+1.
	ANSI = 0xA001
)

Predefined polynomials.

View Source
const Size = 2

Size of a CRC-16 checksum in bytes.

Variables

View Source
var ANSITable = makeTable(ANSI)

ANSITable is the table for the ANSI polynomial.

Functions

func ChecksumANSI

func ChecksumANSI(data []byte) uint16

ChecksumANSI returns the checksum of data using the CRC16-ANSI polynomial.

func NewANSI

func NewANSI() hash16.Hash16

NewANSI creates a new hash.Hash16 that uses the CRC16-ANSI polynomial.

Types

type Table

type Table [256]uint16

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

func MakeTable

func MakeTable(poly uint16) *Table

MakeTable returns the Table constructed from the specified polynomial.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL