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