diff options
author | jaseg <git@jaseg.de> | 2020-11-26 12:38:52 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2020-11-26 12:38:52 +0100 |
commit | 451904a0c5fae3bd28d35c7128df3a9db1a04b26 (patch) | |
tree | b406c126b08032219894db3ff16a2ccf87c667d6 /prototype/fw/src/crc32_test.c | |
parent | e282a5eb373ec4b44d36f580fe642483f2e52794 (diff) | |
download | ihsm-451904a0c5fae3bd28d35c7128df3a9db1a04b26.tar.gz ihsm-451904a0c5fae3bd28d35c7128df3a9db1a04b26.tar.bz2 ihsm-451904a0c5fae3bd28d35c7128df3a9db1a04b26.zip |
Add CRC32 implementation
Diffstat (limited to 'prototype/fw/src/crc32_test.c')
-rw-r--r-- | prototype/fw/src/crc32_test.c | 20 |
1 files changed, 20 insertions, 0 deletions
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 <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; +} |