Java中的CRC计算 [英] CRC calculation in Java

查看:241
本文介绍了Java中的CRC计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用x-modem协议和133个字节的数据包从串行端口读取文件。我在读

I'm reading a file from serialport using x-modem protocol and 133 bytes packet. I'm reading in that

      1 byte is SOH
      2 byte packet number
      3 byte nagative of packet number
next  128 bytes data
      2 bytes CRC sent from other side.

我必须计算从另一端发送的128字节数据和2字节crc的CRC将其设置为单字节,并且必须与我计算出的crc一致。如何在Java中执行此操作?

I have to calculate CRC of 128 bytes data and 2 bytes crc sent from other side that I have to make it single byte and have to comapare with my calculated crc. How can I do this in java?

推荐答案

尝试使用 Jacksum

这篇关于Java中的CRC计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆