Documentation ¶
Overview ¶
Copyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php Package crc8 implements the 8-bit cyclic redundancy check, or CRC-8, checksum.
It provides parameters for the majority of well-known CRC-8 algorithms.
Index ¶
- Variables
- func CalCRC8(data []byte) uint8
- func Checksum(data []byte, table *Table) uint8
- func Complete(crc uint8, table *Table) uint8
- func Init(table *Table) uint8
- func ReverseByte(val byte) byte
- func ReverseUint16(val uint16) uint16
- func ReverseUint8(val uint8) uint8
- func Update(crc uint8, data []byte, table *Table) uint8
- type Params
- type Table
Constants ¶
This section is empty.
Variables ¶
var ( CRC8 = Params{0x07, 0x00, false, false, 0x00, 0xF4, "CRC-8"} CRC8_CDMA2000 = Params{0x9B, 0xFF, false, false, 0x00, 0xDA, "CRC-8/CDMA2000"} CRC8_DARC = Params{0x39, 0x00, true, true, 0x00, 0x15, "CRC-8/DARC"} CRC8_DVB_S2 = Params{0xD5, 0x00, false, false, 0x00, 0xBC, "CRC-8/DVB-S2"} CRC8_EBU = Params{0x1D, 0xFF, true, true, 0x00, 0x97, "CRC-8/EBU"} CRC8_I_CODE = Params{0x1D, 0xFD, false, false, 0x00, 0x7E, "CRC-8/I-CODE"} CRC8_ITU = Params{0x07, 0x00, false, false, 0x55, 0xA1, "CRC-8/ITU"} CRC8_MAXIM = Params{0x31, 0x00, true, true, 0x00, 0xA1, "CRC-8/MAXIM"} CRC8_ROHC = Params{0x07, 0xFF, true, true, 0x00, 0xD0, "CRC-8/ROHC"} CRC8_WCDMA = Params{0x9B, 0x00, true, true, 0x00, 0x25, "CRC-8/WCDMA"} )
Predefined CRC-8 algorithms. List of algorithms with their parameters borrowed from here - http://reveng.sourceforge.net/crc-catalogue/1-15.htm#crc.cat-bits.8
The variables can be used to create Table for the selected algorithm.
Functions ¶
func Checksum ¶
Checksum returns CRC checksum of data usign scpecified algorithm represented by the Table.
func Complete ¶
Complete returns the result of CRC calculation and post-calculation processing of the crc.
func Init ¶
Init returns the initial value for CRC register corresponding to the specified algorithm.
func ReverseByte ¶
func ReverseUint16 ¶
func ReverseUint8 ¶
Types ¶
type Params ¶
type Params struct { Poly uint8 Init uint8 RefIn bool RefOut bool XorOut uint8 Check uint8 Name string }
Params represents parameters of a CRC-8 algorithm including polynomial and initial value. More information about algorithms parametrization and parameter descriptions can be found here - http://www.zlib.net/crc_v3.txt