Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crc16计算结果错误 CRC16 calculation error #3

Open
xiaoa7 opened this issue Dec 15, 2017 · 0 comments
Open

crc16计算结果错误 CRC16 calculation error #3

xiaoa7 opened this issue Dec 15, 2017 · 0 comments

Comments

@xiaoa7
Copy link

xiaoa7 commented Dec 15, 2017

The variable CRC needs to be initialized
//
func Crc16(bs []byte) (crc uint16) {
//init crc
crc = 0xffff
l := len(bs)
for i := 0; i < l; i++ {
crc = ((crc << 8) & 0xff00) ^ crc16tab[((crc>>8)&0xff)^uint16(bs[i])]
}
return
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant