1 /* gcc -O3 -o crc32 crc32.c -lz */
7 #include <encodings/crc32.h>
9 int main(int argc, const char* argv[])
13 fprintf( stderr, "Usage: crc32 <filename>\n" );
17 FILE *file = fopen(argv[1], "rb");
21 uint32_t crc = encoding_crc32(0L, NULL, 0 );
25 uint8_t buffer[16384];
27 int numread = fread((void*)buffer, 1, sizeof(buffer), file);
30 crc = encoding_crc32( crc, buffer, numread );
37 printf("%08x\n", crc);
41 fprintf(stderr, "Error opening input file: %s\n", strerror(errno));