[NUT-devel] Incomplete description of checksum algorithm

Alexander Strasser eclipse7 at gmx.net
Thu Feb 16 01:47:32 CET 2006


Hi,

Michael Niedermayer wrote:
> On Wed, Feb 15, 2006 at 11:19:41PM +0100, Alexander Strasser wrote:
> >   the checksum definition in the current spec seems
> > incomplete or unprecise to me. 
> >   I have prepared the following patch to complement
> > Oded's last change. It is based on the last discussion
> > of the subject on mplayer-dev-eng.
> > 
> >   It is just a suggestion.
> 
> hmm, alternative suggestion:

  looks a bit scary :) and i am way too tired to read it closely...

> crc32 checksum
>     The checksum is choosen so that c(x) is a multiple of
>     x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 over GF(2)
>     c(x) is the polynom coresponding to the block from and including the
>     forward ptr and upto and including the checksum
>     c(x)= (1&(d[0]>>8))*x^(n-1) + (1&(d[0]>>7))*x^(n- 2) + ...
>         + (1&(d[1]>>8))*x^(n-9) + (1&(d[1]>>7))*x^(n-10) + ...
>         + ...
>         + ... + (1&(d[n/8-1]>>1))*x^1 + (1&(d[n/8-1]>>0))*x^0
>     alternatively you can simply run
>     crc=0;
>     for(i=0; i<size; i++){
>         crc ^= buf[i]<<24;
>         for(j=0; j<8; j++)
>             crc= (crc<<1) ^ (0x04C11DB7 & (crc>>31));
>     }
>     over the data  

  ok, while we are at it, should we use non zero initial value? if yes which?

> btw, why doesnt the syncpoint have a packet header / forward ptr !?

  no clue

  Alex (beastd)




More information about the NUT-devel mailing list