Next update
Algorithm for CS1:
data from - 0x04
leight - 0x7C
CS calculated with Tricore internal CRC32 and low half word - CS1
Inicial value - block id
unsigned long crc_buffer(unsigned long crc, const unsigned long *p, unsigned long sz)
{
const unsigned long poly = 0xEDB88320;
unsigned long tmp1, tmp2;
while(sz--)
{
tmp1 = 0;
tmp2 = crc & poly;
for(int i = 0; i <=31; i++ )
tmp1 ^= ((tmp2 >> i) & 1);
crc = *p++ ^ ((crc << 1) | tmp1) ;
}
return crc;
}
great job thankss
i converted this script to c# but i don't know how it works
can any one give an exemple to run this function ?
Example block (exemple of kolocar membre
) :
36 00 F2 78 E2 09 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 6F 79 00 00 B1 6F 00 00 85 7C 88 7C
CS1 = F2 78
ID = 36 00
what is the initial value for cs1
there are 3 varialbes in the crc_buffer function (crc, p, sz) ... wich one is initial value ?
please help