2 * Copyright (c) 1995, Edward B. Hamrick
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee, provided
8 * (i) the above copyright notice and the text in this "C" comment block
9 * appear in all copies of the software and related documentation, and
11 * (ii) any modifications to this source file must be sent, via e-mail
12 * to the copyright owner (currently hamrick@primenet.com) within
13 * 30 days of such modification.
15 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19 * IN NO EVENT SHALL EDWARD B. HAMRICK BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
21 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
22 * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF
23 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 * This CRC algorithm is the same as that used in zip. Normally it
28 * should be initialized with 0xffffffff, and the final CRC stored
29 * should be crc ^ 0xffffffff.
31 * It implements the polynomial:
33 * 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 unsigned long CrcUpdate( /* returns updated crc */
44 unsigned long crc, /* starting crc */
45 unsigned char *buffer, /* buffer to use to update crc */
46 long length /* length of buffer */