summaryrefslogtreecommitdiff
path: root/prototype/fw/test/crc32_test.c
diff options
context:
space:
mode:
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;
+}