]> git.ozlabs.org Git - ccan/blob - ccan/crc32c/_info
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / crc32c / _info
1 #include "config.h"
2 #include <string.h>
3 #include <stdio.h>
4
5 /**
6  * crc32c - routine for Castagnoli CRC (crc32c) of bytes
7  *
8  * Cyclic Redundancy Check routine, optimized for x86-64.  Reasonably fast
9  * checksum routines, but not suitable for cryptographic use.
10  *
11  * They are useful for simple error detection, eg. a 32-bit CRC will
12  * detect a single error burst of up to 32 bits.
13  *
14  * Example:
15  *      #include <ccan/crc32c/crc32c.h>
16  *      #include <stdio.h>
17  *      #include <stdlib.h>
18  *
19  *      // Given "123456789" outputs 0xe3069283
20  *      int main(int argc, char *argv[])
21  *      {
22  *              if (argc != 2) {
23  *                      fprintf(stderr, "Usage: %s <string>\n"
24  *                              "Prints 32 bit CRC of the string\n", argv[0]);
25  *                      exit(1);
26  *              }
27  *              printf("0x%08x\n", crc32c(0, argv[1], strlen(argv[1])));
28  *              exit(0);
29  *      }
30  *
31  * License: MIT
32  * Author: Mark Adler
33  * Maintainer: Rusty Russell <rusty@rustcorp.com.au>
34  */
35 int main(int argc, char *argv[])
36 {
37         if (argc != 2)
38                 return 1;
39
40         if (strcmp(argv[1], "depends") == 0) {
41                 printf("ccan/compiler\n");
42                 return 0;
43         }
44
45         return 1;
46 }