[erlang-questions] checksum calculation
jm
jeffm@REDACTED
Wed Apr 8 01:19:11 CEST 2009
Gamoto wrote:
> Richard,
> Suppose you have an industrial machine which send messages following by the checksum calculated by the xor of all bytes, what can I do with your advices ;-)
> John
>
I take it by this that this is a given and out of your control. In which
case your stuck, but should politely tell the manufacture they're a
bunch of idiots highlighting the drawbacks mentioned by Richard and try
to get the next revision fixed.
If your lucky enough to be able change the checksum take a look at
adler32/1 in the kernel/erlang section of the manual, or
crc32/1 in the same section.
example use of both,
> erlang:adler32([1,2,3,[4,5]]).
2621456
> erlang:crc32([1,2,3,[4,5]]).
1191942644
I hope this solves your problem.
Jeff.
More information about the erlang-questions
mailing list