Rizin
unix-like reverse engineering framework and cli tools
crc32.c File Reference

Primitive CRC32 calculation tool. More...

#include "sysdefs.h"
#include "lzma.h"
#include <stdio.h>

Go to the source code of this file.

Functions

int main (void)
 

Detailed Description

Primitive CRC32 calculation tool.

Definition in file crc32.c.

Function Documentation

◆ main()

int main ( void  )

Definition at line 19 of file crc32.c.

20 {
21  uint32_t crc = 0;
22 
23  do {
24  uint8_t buf[BUFSIZ];
25  const size_t size = fread(buf, 1, sizeof(buf), stdin);
26  crc = lzma_crc32(buf, size, crc);
27  } while (!ferror(stdin) && !feof(stdin));
28 
29  //printf("%08" PRIX32 "\n", crc);
30 
31  // I want it little endian so it's easy to work with hex editor.
32  printf("%02" PRIX32 " ", crc & 0xFF);
33  printf("%02" PRIX32 " ", (crc >> 8) & 0xFF);
34  printf("%02" PRIX32 " ", (crc >> 16) & 0xFF);
35  printf("%02" PRIX32 " ", crc >> 24);
36  printf("\n");
37 
38  return 0;
39 }
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
Definition: cs_driver.c:93
voidpf void uLong size
Definition: ioapi.h:138
voidpf void * buf
Definition: ioapi.h:138
unsigned int uint32_t
Definition: sftypes.h:29
unsigned char uint8_t
Definition: sftypes.h:31
#define PRIX32
Definition: sysdefs.h:70

References printf(), and PRIX32.