Longitudinal Redundancy Check - C

C

unsigned char calculateLRC(const unsigned char *buf, unsigned int n){ unsigned char checksum = 0; while(n>0){ checksum += *buf++; n--; } return ((char) -checksum ); }

Read more about this topic:  Longitudinal Redundancy Check