Re: simple transport protocol



Roman wrote:
) Hello, Willem!
) You wrote on Mon, 26 May 2008 06:18:53 +0000 (UTC):
)
) W> Suppose the checksum is a simple sum modulo 256.
) W> We want to send the values: 2 5 8 10 15 20
) W> So, the total of what we send is this:
)
) W> length | data | crc
)
)
) W> 0 7 2 5 8 10 15 20 196
)
) W> What I do _is_ sum % 256. Read it again, more carefully.
) Alright, from the example above, considering the values are decimal:
) 2+5+8+10+15+20 = 60, 60 mod 256 = 60, not 196. How then you get 196?

Here's the bit that I wrote that you did not quote:

) >Now, if we calculate the checksum on the seven received bytes:
) >2+5+8+10+15+20+196 (modulo 256) = 0
) >
) >This 0 means the check succeeded, no compare necessary.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.



Relevant Pages

  • Re: simple transport protocol
    ... Roman wrote: ... W> Suppose the checksum is a simple sum modulo 256. ... You all think I'm paranoid, ...
    (comp.programming)
  • Re: simple transport protocol
    ... W> Suppose the checksum is a simple sum modulo 256. ... Some misunderstanding of terms: you sum up the values to be transmitted and ...
    (comp.programming)
  • Re: Never-increasing compression
    ... )> Yes -- but as long as I introduce it only when I can compress the data ... )> enough to leave room for the checksum, then I respect the "no size ... )> to be collision-resistant ... You all think I'm paranoid, ...
    (comp.compression)
  • Re: simple transport protocol
    ... W> To make it easier for the target size, you calculate what byteto add ... W> at the end so that the calculated checksum turns out to be 0. ... Are you saying CRC is to be added at the end ... You all think I'm paranoid, ...
    (comp.programming)
  • Re: Compare a hex value with 4 single bytes in C
    ... How can I compare the saved checksum with my result? ... You all think I'm paranoid, ...
    (comp.programming)