From 451904a0c5fae3bd28d35c7128df3a9db1a04b26 Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 26 Nov 2020 12:38:52 +0100 Subject: Add CRC32 implementation --- prototype/fw/src/crc32_test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 prototype/fw/src/crc32_test.c (limited to 'prototype/fw/src/crc32_test.c') diff --git a/prototype/fw/src/crc32_test.c b/prototype/fw/src/crc32_test.c new file mode 100644 index 0000000..e23bb37 --- /dev/null +++ b/prototype/fw/src/crc32_test.c @@ -0,0 +1,20 @@ + +#include + +#include "crc32.h" + +int main(void) { + crc32_t state = crc32_reset(); + + do { + char c; + if (fread(&c, 1, 1, stdin) != 1) + break; + + state = crc32_update(state, (uint8_t)c); + } while(23); + + state = crc32_finalize(state); + printf("%08x\n", state); + return 0; +} -- cgit