#include #include #include #include #include "src/tinycrc.h" void test(const uint8_t* buffer) { uint32_t crc32 = tinycrc_crc32(buffer, strlen((char*)buffer)); uint16_t crc16 = tinycrc_crc16(buffer, strlen((char*)buffer)); uint8_t crc8 = tinycrc_crc8(buffer, strlen((char*)buffer)); printf("%-32s | %08x | %04x | %02x\n", (char*)buffer, crc32, crc16, crc8); } int main() { uint8_t* buffer = (uint8_t*)malloc(32); printf("%-32s | %8d | %4d | %2d\n", (char*)buffer, 32, 16, 8); memset((char*)buffer, 0, 32); strcpy((char*)buffer, "Hello World\0"); test(buffer); memset((char*)buffer, 0, 32); strcpy((char*)buffer, "Hello World!\0"); test(buffer); memset((char*)buffer, 0, 32); strcpy((char*)buffer, "Hello Worlds\0"); test(buffer); memset((char*)buffer, 0, 32); strcpy((char*)buffer, "Testing\0"); test(buffer); free(buffer); }