/*this is the CRC function */ /* you have to pass the buf to this function or make it a global variable */ unsigned long crce( ) { long k,q,pol; unsigned long crc; crc = 0; pol=0x104c11db7; // I picked this polynomial but you can pick another one for(q=0;q<8*4*sizeof(long);q++) { k=crc&(1<<31); crc <<= 1; if(buf[q/32]&(1<<(31-q%32))) crc|=1; if(k) crc^=pol; } return crc; } /* End of CRC function */ // oh, do not for get to add a prototype for the function