[erlang-questions] checksum calculation
Gamoto
gamoto@REDACTED
Mon Apr 6 01:29:12 CEST 2009
I have a string of bytes and would like to compute the checksum which is the xor of all bytes.
Let S the string, N the current byte
checksum( <<N,Rest>>,Csum) ->
checksum(Rest,Csum bxor N);
The problems are: I don't know how to start (checksum(<<S>>) ???) and how to finish !
First of all, is it the correct approach ?
(I suppose I rather should make Csum Exclusive-OR N modulo 8 ???)
More information about the erlang-questions
mailing list