crc

package
v0.0.0-...-de2953b Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const POLY uint32 = 0x4C11DB7 //  birrev:0xedb88320 (IEEE)

Variables

This section is empty.

Functions

func Crc32

func Crc32(data []byte) uint32

func Crc4

func Crc4(data uint) uint

https://my.oschina.net/iwuyang/blog/198630

CRC4运算

Poly生成项: 1001,长度为4 - 宽度为 w=3(第一位始终为1,异或时始终为0,所以可忽略第一位)

位串BitString : 11110 - 需借位w 11110 + 000 = 11110000(确保位串每一位都被除一遍)

运算过程: - 运算中只有位串首位为1才运算,否则跳过

11110000 1001|||| - -------------

1100|||
1001||| -

------------

1010||
1001|| -

-----------

0110|
0000| -

----------

1100
1001 -

---------

101 --> 5,余数 --> The CRC!

Types

This section is empty.

Jump to

Keyboard shortcuts

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