crc16

package module
v0.0.0-...-7713e2f Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MulanPSL-2.0 Imports: 0 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

crc16

介绍

查表法实现crc16算法.参数模型是CRC-16/MODBUS 多项式是8005。

导入到项目中

import "gitee.com/jdhxyy/crc16"

API

// CheckSum 校验和.参数模型是CRC-16/MODBUS 多项式是8005
// 返回值是高字节在前的16位校验值
func CheckSum(bytes []uint8) uint16

示例

func TestCheckSum(t *testing.T) {
    arr := []uint8{1, 2, 3}
    fmt.Printf("0x%04x", CheckSum(arr))
}

输出:

=== RUN   TestCheckSum
0x6161--- PASS: TestCheckSum (0.00s)
PASS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checksum

func Checksum(bytes []uint8) uint16

Checksum 校验和.参数模型是CRC-16/MODBUS 多项式是8005 返回值是高字节在前的16位校验值

Types

This section is empty.

Jump to

Keyboard shortcuts

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