crc8

package module
v0.0.0-...-380c225 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2017 License: BSD-3-Clause Imports: 1 Imported by: 4

README

crc8

GoDoc

crc8 implements the 8-bit cyclic redundancy check, or CRC-8. It's entirely copied from Go's standard library hash/crc32 with obvious edits to change the CRC-32 hash functions into CRC-8.

Documentation

Overview

Package crc8 implements the 8-bit cyclic redundancy check, or CRC-8, checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for information.

Index

Constants

View Source
const Size = 1

The size of a CRC-8 checksum in bytes.

Variables

This section is empty.

Functions

func Checksum

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

Checksum returns the CRC-8 checksum of data using the polynomial represented by the Table.

func Update

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

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

Types

type Hash8

type Hash8 interface {
	hash.Hash
	Sum8() uint8
}

Hash8 is the common interface implemented by all 8-bit hash functions.

func New

func New(tab *Table) Hash8

New creates a new hash.Hash8 computing the CRC-32 checksum using the polynomial represented by the Table. Its Sum method will lay the value out in big-endian byte order.

type Table

type Table [256]uint8

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

func MakeTable

func MakeTable(poly uint8) *Table

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

Jump to

Keyboard shortcuts

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