source: main/trunk/greenstone2/build-src/packages/isis-gdl/CRC32.h@ 26670

Last change on this file since 26670 was 6127, checked in by mdewsnip, 20 years ago

IsisGdl package for reading CDS/ISIS databases. Provided by Jean-Claude Dauphin at UNESCO, and modified slightly to compile and run under Linux.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/**********************************************************************
2 *
3 * CRC32.h
4 * Copyright (C) 2003 UNESCO
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *********************************************************************/
25
26////////////////////////////////////////////////////////////////////////////////////
27// CRC32.H
28//
29// The CRC32 functions (Cyclic Redundancy Check) are used to
30// calculate a sophisticated checksum based on the algebra of
31// polynomials. The Cyclic Redundancy Check, is a way to detect
32// bit errors that occur during data storage or transmission.
33// The CRC-32 algorithm operates on a block of data as a single
34// large numerical value. The algorithm divides this large value
35// by the CRC-32 polynomial or generator polynomial, leaving the
36// remainder 32-bit, which is the checksum.
37#ifndef __CRC32_H__
38#define __CRC32_H__
39
40#include <fstream>
41
42unsigned long CalcCRC32(char *buf, unsigned len);
43unsigned long CalcCRC32(const char *buf, unsigned len);
44unsigned long CalcCRC32(unsigned char c, unsigned long CRC);
45unsigned long CalcCRC32(std::fstream &infile);
46
47#ifdef __USE_CRC32_TABLE_FUNCTIONS__
48#include <iostream>
49int makeCRC32(std::ostream &stream);
50#endif
51
52#endif // __CRC32_H__
Note: See TracBrowser for help on using the repository browser.