summaryrefslogtreecommitdiff
path: root/ccan/crc/_info
blob: c59d58ec8e19eb847a7d54d8926eefa0890e3a2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "config.h"
#include <string.h>
#include <stdio.h>

/**
 * crc - routines for crc of bytes
 *
 * Cyclic Redundancy Check routines.  These are reasonably fast
 * checksum routines, but not suitable for cryptographic use.
 *
 * They are useful for simple error detection, eg. a 32-bit CRC will
 * detect a single error burst of up to 32 bits.
 *
 * Example:
 *	#include <ccan/crc/crc.h>
 *	#include <stdio.h>
 *	#include <stdlib.h>
 *
 *	// Given IHATEMATH outputs 0x98a3b8df
 *	int main(int argc, char *argv[])
 *	{
 *		if (argc != 2) {
 *			fprintf(stderr, "Usage: %s <string>\n"
 *				"Prints 32 bit CRC of the string\n", argv[0]);
 *			exit(1);
 *		}
 *		printf("0x%08x\n", crc32c(0, argv[1], strlen(argv[1])));
 *		exit(0);
 *	}
 *
 * License: GPL (v2 or any later version)
 * Author: Gary S. Brown, Clay Haapala
 * Maintainer: Rusty Russell <rusty@rustcorp.com.au>
 */
int main(int argc, char *argv[])
{
	if (argc != 2)
		return 1;

	if (strcmp(argv[1], "depends") == 0) {
		printf("ccan/array_size\n");
		return 0;
	}

	return 1;
}