[NUT-devel] Incomplete description of checksum algorithm

Michael Niedermayer michaelni at gmx.at
Thu Feb 16 01:10:41 CET 2006


Hi

On Wed, Feb 15, 2006 at 11:19:41PM +0100, Alexander Strasser wrote:
> Hi,
> 
>   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:

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


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

[...]

-- 
Michael




More information about the NUT-devel mailing list