Bug#1057882: ITP: golang-github-howeyc-crc16 -- Implements the 16-bit cyclic redundancy check, or CRC-16, checksum
Package: wnpp
Severity: wishlist
Owner: tony mancill <tmancill@debian.org>
* Package name : golang-github-howeyc-crc16
Version : 0.0~git20171223.2b2a61e-1
Upstream Author : Chris Howey
* URL : https://github.com/howeyc/crc16
* License : BSD-3-clause
Programming Lang: Go
Description : Implements the 16-bit cyclic redundancy check, or CRC-16, checksum
GoDoc (https://godoc.org/github.com/howeyc/crc16) Build Status
(http://travis-ci.org/howeyc/crc16)
.
CRC16
.
A Go package implementing the 16-bit Cyclic Redundancy Check, or CRC-16,
checksum.
.
Usage
.
To generate the hash of a byte slice, use the crc16.Checksum()
(https://godoc.org/github.com/howeyc/crc16#Checksum) function:
.
import "github.com/howeyc/crc16"
.
data := byte("test")
checksum := crc16.Checksum(data, crc16.IBMTable)
.
The package provides the following
(https://godoc.org/github.com/howeyc/crc16#pkg-variables) hashing tables.
For each of these tables, a shorthand can be used.
.
// This is the same as crc16.Checksum(data, crc16.IBMTable)
checksum := crc16.ChecksumIBM(data)
.
Using the hash.Hash (https://godoc.org/hash#Hash) interface also works.
.
h := crc16.New(crc16.IBMTable)
data := byte("test")
data2 := byte("data")
h.Write(data)
h.Write(data2)
checksum := h.Sum(nil)
.
Changelog
.
* 2017.03.27 - Added MBus checksum
* 2017.05.27 - Added checksum function without XOR
* 2017.12.08 - Implement encoding.BinaryMarshaler and
encoding.BinaryUnmarshaler to allow saving and recreating their
internal state.
--
The rationale for packaging is github.com/howeyc/crc16 is that it is a
dependency of github.com/harenber/ptc-go, which will permit enabling
PACTOR modem support in pat (winlink), as discussed in #1057276:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1057276
Reply to: