|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: [Tsvwg] [SCTP checksum problems]All, A few corrections to this post. #define BASE 65521 unsigned short s1 = 0x5555; unsigned s2 = 0; unsigned short dat_buf* while (length -= 2) { s1 += ntoh(*dat_buf++); /* 16 bit summing */ s2 += s1; if (s2 >= BASE) /* Adler modulo for s2 only */ s2 -= BASE; } return (s2 << 16) s1 ); The 32 bit CRC table for an 8 bit lookup would be 1k byte in size and not 512 bytes. > Lloyd, > > I am aware of efforts to compare CRC with Alder-32. CRC that is primarily > aimed at providing burst error detection but if while trying various > techniques, this modification may be interesting. > > #define BASE 65521 > unsigned s1 = 0x5555; > unsigned s2 = 0; > unsigned short dat_buf* > > while (length -= 2) > { > s1 += ntoh(*dat_buf++); /* 16 bit summing */ > s2 += s1; > if (s2 >= BASE) /* Adler modulo for s2 only */ > s2 -= BASE; > } > return (s2 << 16) | (s1 & 0xffff); > > This would exercise more bits for small packets, improve burst error > sensitivity and trade a modulo function for a network to host swap in some > cases. It seems to become a comparison against burst errors vs. missing > segment and stuck bit sensitivity. > > The alternative code for CRC would look something like this. > > Here is an example using a 256 entry (512 byte) table. > > unsigned char* dat_buf; > unsigned long crc_syn = 0xffffffff; > > while(length--) > crc_syn = (crc_syn >> 8) ^ crc32_table[(crc_syn & 0xff) ^ *dat_buf++]; > > return (crc_syn ^ 0xffffffff); > > > Doug
Home Last updated: Tue Sep 04 01:04:58 2001 6315 messages in chronological order |