在C中寻找校验和例程 [英] looking for a checksum routine in C

查看:77
本文介绍了在C中寻找校验和例程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在寻找一种计算内存块校验和的方法,

我想使用一个可读的两个字符(0..9,A..Z)代表这个

校验和,所以校验和应该小于1296.我在看

crc8,它的结果是8位,那只是256,crc16'的结果是65535,

这比两个char可以容纳的更多,任何想法如何

实现这一目标?甚至不到1296,1024也可以。


谢谢,


Angelo

Hi,

I''m looking for a way to calculate a checksum for a block of memory,
I''d like to use a readable two char(0..9, A..Z) to represent this
checksum, so the checksum should be less than 1296. I''m looking at
crc8, its result is 8 bits, that''s only 256, crc16''s result is 65535,
that''s more than what the two char can accommodate, any idea how to
achieve this? even less than 1296, 1024 will do.

Thanks,

Angelo

推荐答案

Angelo Chen< an *********** @ gmail.comwrote:
Angelo Chen <an***********@gmail.comwrote:

我正在寻找一种计算内存块校验和的方法,

我想用一个可读的两个字符(0..9,A..Z)代表这个

校验和,所以校验和应该小于1296.我在看

crc8,结果是8位,那只是256,crc16'的结果是65535 ,

,这比两个char可以容纳的更多,任何想法如何实现这个?b $ b即使不到1296,也会有1024。
I''m looking for a way to calculate a checksum for a block of memory,
I''d like to use a readable two char(0..9, A..Z) to represent this
checksum, so the checksum should be less than 1296. I''m looking at
crc8, its result is 8 bits, that''s only 256, crc16''s result is 65535,
that''s more than what the two char can accommodate, any idea how to
achieve this? even less than 1296, 1024 will do.



所以你想要的基本上是一个CRC-10,质量不一定要高得多,因此,b $ b非常高那些规格,你不打算与其他人分享你的b $ b bCs。


我强烈怀疑CRC-10的网络搜索会对你有帮助你好。


Richard

So what you want is basically a CRC-10, and the quality won''t need to be
fabulously high since, with those specs, you''re not going to share your
CRCs with anybody else.

I strongly suspect a websearch on CRC-10 would be helpful to you.

Richard


Angelo Chen写道:
Angelo Chen wrote:

我正在寻找一种计算内存块校验和的方法,

我想用一个可读的两个字符(0..9,A..Z)来表示这个

校验和,所以校验和应该小于1296.我在看

crc8,结果是8位,那只是256,crc16 '结果是65535,

,这比两个char可以容纳的更多,任何想法如何实现这个?b $ b实现这个目标?即使不到1296,也会有1024。
I''m looking for a way to calculate a checksum for a block of memory,
I''d like to use a readable two char(0..9, A..Z) to represent this
checksum, so the checksum should be less than 1296. I''m looking at
crc8, its result is 8 bits, that''s only 256, crc16''s result is 65535,
that''s more than what the two char can accommodate, any idea how to
achieve this? even less than 1296, 1024 will do.



我会使用16位或32位CRC,然后减少mod 1296.


-

Thad

I would use a 16- or 32-bit CRC and then reduce mod 1296.

--
Thad


6月19日,9:34 * pm,Thad Smith< ThadSm ... @ acm.orgwrote:
On Jun 19, 9:34*pm, Thad Smith <ThadSm...@acm.orgwrote:

我会使用16位或32位CRC,然后减少mod 1296.
I would use a 16- or 32-bit CRC and then reduce mod 1296.



这是一个解决方案,但理查德建议crc10,这也是一个很好的

方法,我还在搜索任何示例代码,到目前为止,没有

工作代码结果。

That''s one solution, but Richard suggests crc10, that''s a good
approach too, I''m still searching for any sample code, so far, none
working code turned out.


这篇关于在C中寻找校验和例程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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