i have a 4byte unsigned char that contain "7b13059c" hex format. this is a part from a 6byte unsigned char data "99887b13059c" which is the checksum for the 2byte "9988" data.
after i generate a checksum using a function, i got 7b13059c hex checksum that is stored in an unsigned long var.how can i compare it with the checksum in the 4byte unsigned char.
the situation is something like this :
can anybody help me with this?
unsigned char keydata; //keydata will contain "99887b13059c"
unsigned char key;
unsigned char check_sum;
unsigned long SUM;
unsigne char skeysat;
memcpy(key, keydata, 2); //store the "9988" part from the "99887b13059c" in key
memcpy(check_sum, keydata+2, 4); //store the "7b13059c" part from the "99887b13059c" in check_sum
checksum(2, key, &SUM) //generate 7b13059c hex checksum n stored in SUM
//if SUM == check_sum ( 7b13059c == "7b13059c" )store key in skeysat
//else respon invalid checksum