#ifndef __CRC_H__ #define __CRC_H__ /* * $Id: crc.h,v 1.6 1993/12/08 13:58:56 edvkai Exp $ * * Copyright (C) 1986 Gary S. Brown. You may use this program, or * code or tables extracted from it, as desired without restriction. * * $Log: crc.h,v $ * Revision 1.6 1993/12/08 13:58:56 edvkai * Removed false RCSids from log. * * Revision 1.5 1993/08/04 12:15:26 edvkai * C++ * * Revision 1.4 1992/02/14 18:07:54 ak * *** empty log message *** * * Revision 1.3 1992/01/03 14:19:08 ak * * Revision 1.2 1992/01/03 13:44:45 ak * Zortech fixes. * * Revision 1.1.1.1 1991/12/12 16:09:55 ak * Initial checkin of server source, modified to contain RCS IDs. * * Revision 1.1 1991/12/12 16:09:51 ak * Initial revision * */ /**********************************************************************\ |* *| |* Library functions to compute the 32-bit CRC used as the frame *| |* check sequence in ADCCP (ANSI X3.66, also known as FIPS PUB 71 *| |* and FED-STD-1003, the U.S. versions of CCITT's X.25 link-level *| |* protocol). The 32-bit FCS was added via the Federal Register, *| |* 1 June 1982, p.23798. I presume but don't know for certain that *| |* this polynomial is or will be included in CCITT V.41, which *| |* defines the 16-bit CRC (often called CRC-CCITT) polynomial. FIPS *| |* PUB 78 says that the 32-bit FCS reduces otherwise undetected *| |* errors by a factor of 10^-5 over 16-bit FCS. *| |* *| \**********************************************************************/ #ifdef __cplusplus extern "C" { #endif /* Need an unsigned type capable of holding 32 bits; */ typedef unsigned long int UNS_32_BITS; extern const UNS_32_BITS crc_32_tab[]; /* initialize crc to 0xFFFFFFFFuL */ #define crc32_byte(octet, crc) (crc_32_tab[((crc)^(octet)) & 0xff] ^ ((crc)>>8)) extern UNS_32_BITS crc32(void *ptr, unsigned len, UNS_32_BITS crc); #ifdef __cplusplus } #endif #endif