summaryrefslogtreecommitdiff
path: root/prototype/fw/test/crc32_test.c
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2020-11-26 17:42:05 +0100
committerjaseg <git@jaseg.de>2020-11-26 17:42:05 +0100
commit44548df52f8f5e1dcfdc7b3cfdd7024d9d3bf50a (patch)
tree9198f87b0f41ef96aa4f51db1595b9156b7955a1 /prototype/fw/test/crc32_test.c
parent9b5625f12ae067a1583252d41febef848f055588 (diff)
downloadihsm-44548df52f8f5e1dcfdc7b3cfdd7024d9d3bf50a.tar.gz
ihsm-44548df52f8f5e1dcfdc7b3cfdd7024d9d3bf50a.tar.bz2
ihsm-44548df52f8f5e1dcfdc7b3cfdd7024d9d3bf50a.zip
Add COBS encoder
Diffstat (limited to 'prototype/fw/test/crc32_test.c')
-rw-r--r--prototype/fw/test/crc32_test.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/prototype/fw/test/crc32_test.c b/prototype/fw/test/crc32_test.c
new file mode 100644
index 0000000..e23bb37
--- /dev/null
+++ b/prototype/fw/test/crc32_test.c
@@ -0,0 +1,20 @@
+
+#include <stdio.h>
+
+#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;
+}