BCC算法的C实现
1.1、BCC.h
#ifndef BCC_H
#define BCC_H

    #include <stdlib.h>

    #ifdef __cplusplus
        extern "C" {
    #endif

    unsigned char BCC(unsigned char *bytes, size_t bytesLength);

    #ifdef __cplusplus
        }
    #endif
#endif
1.2、BCC.c
#include "BCC.h"

unsigned char BCC(unsigned char* bytes, size_t bytesLength) {
    unsigned char byte = 0;
    for (size_t i = 0; i < bytesLength; i++) {
        byte ^= bytes[i];
    }
    return byte;
}