Re: How to calculate the checksum?

Tech-Archive recommends: Fix windows errors by optimizing your registry




"Christian Havel" <ChristianHavel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:6713ABF0-C84F-40BE-A065-E6E14D1EF503@xxxxxxxxxxxxxxxx
Hi Arne,

thanks for your help. I have the following informations:

<Sync_1 = 0x81> 8 DATA-BITS No Parity
<Sync_2 = 0x82> 8 DATA-BITS No Parity
<Cksum> = Telegramm<[pos_Sync_1]> XOR . XOR . XOR ... [<pos_Sync_2-2>]
<Cmd> = Command to modem

|<--- CheckSum : --------------- XOR ------------------->|
<Sync_1>, <DEV_ADR>, <Cmd>, <OPTION>, [<DATA>], <Chksum>, <Sync_2>


It depends on what sort of CRC it is.

For most serial protocols it is based on the table driven one in x/y/zmodem source code. However that isn't the correct CRC value for an ethernet packet OR an SDLC/HDLC comms protocol.

You could use
http://sourceforge.net/projects/classlesshasher/?format=raw

which contains more CRC variants than I've encountered in the wild but most comms protocols tend to use the one contained in FCS16.

I suspect from your code that actually you just want to XOR all the bytes in the data together.

Without a sample data packet (or sample source code) it's nearly impossible to tell if you've got it right. When I first did the ethernet one I ended up hand decoding a packet on an oscilloscope screen to see exactly what was transmitted!

Peter

.



Relevant Pages

  • [NEWS] Downgrading the Oracle Native Authentication
    ... Get your security news from a reliable source. ... Oracle native authentication protocols are typical challenge-response ... After some negotiation the client sends the username. ... calls it packet version ...
    (Securiteam)
  • iptables questions
    ... FORWARD chain because if no connection has been established from my ... the packet will be handled by the INPUT ... supported and how would I go about having other protocols recognised? ...
    (comp.os.linux.security)
  • Re: failed shields up test
    ... Try to ping one - you'll probably get a response, ... Now, plug the cable back in, and fire up that packet sniffer on "this" ... protocols that can be found in an IP packet (see figure 3.1 in RFC0791 ...
    (alt.os.linux.suse)
  • Re: failed shields up test
    ... Try to ping one - you'll probably get a response, ... Now, plug the cable back in, and fire up that packet sniffer on "this" ... protocols that can be found in an IP packet (see figure 3.1 in RFC0791 ...
    (alt.os.linux.suse)
  • Re: Cisco IOS Denial of Service that affects most Cisco IOS routers- requires power cycle to recove
    ... > protocols is not yet public AFAIK. ... The router has problems if it receives a packet, content irrelevant, ... world's premier technical IT security event! ...
    (Incidents)