]> git.ozlabs.org Git - ccan/blob - ccan/crc/_info
295195c4ef0d82b8afcc791bc36c318ef8248361
[ccan] / ccan / crc / _info
1 #include <string.h>
2 #include <stdio.h>
3
4 /**
5  * crc - routines for crc of bytes
6  *
7  * Cyclic Redundancy Check routines.  These are reasonably fast
8  * checksum routines, but not suitable for cryptographic use.
9  *
10  * They are useful for simple error detection, eg. a 32-bit CRC will
11  * detect a single error burst of up to 32 bits.
12  *
13  * Example:
14  *      #include <ccan/crc/crc.h>
15  *      #include <stdio.h>
16  *      #include <stdlib.h>
17  *
18  *      int main(int argc, char *argv[])
19  *      {
20  *              if (argc != 2) {
21  *                      fprintf(stderr, "Usage: %s <string>\n"
22  *                              "Prints 32 bit CRC of the string\n", argv[0]);
23  *                      exit(1);
24  *              }
25  *              printf("0x%08x\n", crc32c(0, argv[1], strlen(argv[1])));
26  *              exit(0);
27  *      }
28  *
29  * License: GPL (v2 or any later version)
30  * Author: Gary S. Brown, Clay Haapala
31  * Maintainer: Rusty Russell <rusty@rustcorp.com.au>
32  */
33 int main(int argc, char *argv[])
34 {
35         if (argc != 2)
36                 return 1;
37
38         if (strcmp(argv[1], "depends") == 0) {
39                 printf("ccan/array_size\n");
40                 return 0;
41         }
42
43         return 1;
44 }