Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/externals/figlet/crc.h
12240 views
1
/*
2
* crc.h - CRC calculation routine
3
*
4
* Version 1.0.1
5
*/
6
7
/*
8
* Copyright (C) 1995, Edward B. Hamrick
9
*
10
* Permission to use, copy, modify, and distribute this software and
11
* its documentation for any purpose and without fee is hereby granted,
12
* provided that the above copyright notice appear in all copies and
13
* that both that copyright notice and this permission notice appear in
14
* supporting documentation, and that the name of the copyright holders
15
* not be used in advertising or publicity pertaining to distribution of
16
* the software without specific, written prior permission. The copyright
17
* holders makes no representations about the suitability of this software
18
* for any purpose. It is provided "as is" without express or implied warranty.
19
*
20
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
21
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
22
* IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
23
* OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
24
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
25
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
26
* OF THIS SOFTWARE.
27
*/
28
29
/*
30
* Changes from 1.0 to 1.0.1:
31
* Relicensed under the MIT license, with consent of the copyright holders.
32
* Claudio Matsuoka (Jan 11 2011)
33
*/
34
35
/*
36
* This CRC algorithm is the same as that used in zip. Normally it
37
* should be initialized with 0xffffffff, and the final CRC stored
38
* should be crc ^ 0xffffffff.
39
*
40
* It implements the polynomial:
41
*
42
* x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1
43
*/
44
45
#ifndef __CRC_H
46
#define __CRC_H
47
48
#ifdef __cplusplus
49
extern "C" {
50
#endif
51
52
unsigned long CrcUpdate( /* returns updated crc */
53
unsigned long crc, /* starting crc */
54
unsigned char *buffer, /* buffer to use to update crc */
55
long length /* length of buffer */
56
);
57
58
#ifdef __cplusplus
59
}
60
#endif
61
62
#endif
63
64