Subject: [rohc] SigComp: CRC

From: Zoltan Barczikay <[email-masked]>
Date: Fri, 26 Jul 2002 16:05:31 +0200 (MEST)

Hi,

could someone post here a test sequence for CRC calculation in UDVM?
That is, a byte sequence and the CRC value for that.
I would like to test my implementation.

Thanks in advance, 
Zoltan Barczikay  ( ERICSSON )

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

---

From: "Surtees, Abigail" <[email-masked]>
Date: Mon, 29 Jul 2002 11:52:09 +0100

Hi Zoltan,

This email has raised an interesting point.  I think the text in the draft is potentially misleading.

Section 9.3.5 defines the polynomial and refers to the PPP RFC which defines an LSB first CRC as in Carsten's perl script on the alternative ROHC website.

It then goes on to say that the CRC should be done MSB first.

I've just checked our implementation and we do an LSB first implementation (which conforms with PPP but not with SigComp).  We have achieved interoperation with other implementers so presumably they do LSB first too.  Carsten? Adam?

For reference over the data:
01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 

the 16 bit LSB crc is 62cb 
and the 16 bit MSB crc is 696.

Comments?

Regards,

Abbie

Abbie Surtees
Engineer
Internet Applications and Mobility
Roke Manor Research Ltd
Tel:   +44 (0) 1794 833131

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

>-----Original Message-----
>From: Zoltan Barczikay [mailto:[email-masked]]
>Sent: 26 July 2002 15:06
>To: [email-masked]
>Subject: [rohc] SigComp: CRC
>
>
>Hi,
>

---

From: Zoltan Barczikay <[email-masked]>
Date: Tue, 30 Jul 2002 17:02:18 +0200 (MEST)

> Section 9.3.5 defines the polynomial and refers to the PPP RFC which defines
> an LSB first CRC as in Carsten's perl script on the alternative ROHC website.
>
> 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 80 81 
82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 
> and the 16 bit MSB crc is 696.

Hi Abigail,
thanks for the sample sequence.

If I take the perl script from Carstens site I indeed get these values:

do_crc(16, 0x8408, $string) = 62cb      (LSB first)
do_crc(16, 0x1021, $string) = 0696      (MSB first)

I am happy with the first one (62cb), but I dont understand why do
you reverse the polynomial for the MSB first case? I think we
should modify the do_crc subroutine instead, taking the input bits
from the other end of the $byte variable:

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 = 0; $b < 8; $b++ ) {
	    if (($crc & 1) ^ ($byte & 0x80)) {
		$crc >>= 1;
		$crc ^= $poly;
	    } else {
		$crc >>= 1;
	    }
	    $byte <<= 1;
	}
    }
    $crc &= 0x0000ffff;
    printf "CRC: %04X\n", $crc;
}

Then, we calculate the CRC without reversing the polynomial:

do_crc2(16, 0x8408, $string) = eeb8      (MSB first)

By the way, what should be the initial content of the shiftregister?
The perl script from Carsten sets it to 0xffff, but this is prescribed
for ROHC only. The SigComp draft does not say anything about it.

Best regards, 
Zoltan.

---

From: "Surtees, Abigail" <[email-masked]>
Date: Wed, 31 Jul 2002 13:20:48 +0100

Hi Zoltan,
>from the other end of the $byte variable:

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.

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.

The question remains, whether to use MSB as specified in the draft or LSB as in ROHC and PPP (cited in the draft)?

I believe for an LSB crc the initial value is assumed to be 'all 1s' but for an MSB it can be specified (and should be if MSB is agreed for SigComp).

Best regards,

Abbie

Abbie Surtees
Engineer