Subject: [rohc] RE: SigComp: CRC

From: Zoltan Barczikay <[email-masked]>
Date: Thu, 1 Aug 2002 15:02:00 +0200 (MEST)

Abigail,
thank you again for your reply.

> I have realised that we were running the LSB algorithm for the MSB result.
> Sorry for the confusion.  The MSB result we get is e575.

I fixed a fault in my code (see corrected version below), and now I get
CRC = 4dca for the MSB case...

> Our algorithm for MSB is different from yours below. The polynomial does need 
to be reversed.  We'd prefer to stick to a decision between the 2 algorithms 
with which we have interoperated in the past.

What is actually your algorithm?

In theory, CRC is defined by division with the generator polynomial. It means 
that when the input bit sequence corresponds to the generator polynomial, we 
should get CRC = 0.

Can you confirm that you get CRC=0 for this sequence:

ff ff 01 10 21

(We need the leading two FFs because of initializing the shift register to all 
1s.)

If not, what is the simplest sequence that gives CRC=0 in your view?

Best regards, 
Zoltan Barczikay.

-------------------------------------------------------------------
Corrected Perl code for CRC calculation:

sub do_crc2($$$) {
    my $nbits = shift;
    my $poly = shift;
    my $string = shift;

    my $crc = ($nbits == 32 ? 0xffffffff : (1 << $nbits) - 1);

    for (my $i = 0; $i < length($string); ++$i) {
	my $byte = ord(substr($string, $i, 1));
	for( my $b = 7; $b >= 0; $b-- ) {
	    if (($crc & 1) ^ (($byte >> $b) & 1)) {
		$crc >>= 1;
		$crc ^= $poly;
	    } else {
		$crc >>= 1;
	    }
	}
    }
    $crc &= 0x0000ffff;

    printf "%2d bits, ", $nbits;
    printf "CRC: %04X\n", $crc;
}

do_crc2(16, 0x8408, $string);

_______________________________________________
Rohc mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/rohc

---

From: "West, Mark (ITN)" <[email-masked]>
Date: Fri, 02 Aug 2002 10:03:45 +0100

Hi all,

A couple of comments and a suggestion...

> What is actually your algorithm?

Hopefully this is unimportant.

The point here wasn't to get into a discussion about the relative merits 
of different algorithms for computing CRCs (or CRC-like checksums).

The original point was that there was some confusion between the 
reference to the PPP FCS-16 *polynomial*, but specifying an MSB-first 
computation.

RFC-3095 also experienced confusion over CRC algorithms, as discovered 
at the first interoperability test.  So, this is not new... ;-) 
However, we have clarified this in the implementer's guide (and the 
implementations!) to say that all 'CRC's [mathematically 'correct' or 
not] are calculated in the same way as the PPP FCS in RFC 1662.

So, why not just say for sigcomp that we'll use FCS-16 from RFC 1662? 
Then rohc would have a consistent approach to checksums.  1662's even 
got some nice efficient table-driven code...

Cheers,

Mark.

-- 
Mark A. West, Consultant Engineer
Roke Manor Research Ltd., Romsey, Hants.  SO51 0ZN
Phone +44 (0)1794 833311   Fax  +44 (0)1794 833433

Yes, I do know that my disclaimer is in an attachment.  And, no, I 
didn't ask for it to be that way.  Oh yes, and:

Permission is hereby granted to pass the contents of this communication
to third parties and any restrictions regarding confidentiality do not
apply