CRC Library
Cyclic redundancy check (CRC) is a method for calculating checksums that is mainly used in network protocols.
The following algorithms are supported by the library:
File information
Classes
Crc
class Crc {
public:
static dword crc32(dword crc, const void *buf, int size);
};
Overview
The Crc class defines static functions for calculating checksums.
Public functions
crc32 (static function)
Calculation of CRC32 checksums. The function can be called multiple times in order to process chunked data.
Parameters
dword crc |
Set to 0 for the first (or only) chunk of data. Set to the last returned value for all subsequent chunks.
|
const void * buf |
The data to be processed.
|
int size |
The number of bytes from buf to be processed.
|
Return value
dword |
The calculated checksum.
|
Code Example
Calculating a CRC32 checksum
dword checksum = 0;
checksum = Crc::crc32(checksum, block1, block1_len);
checksum = Crc::crc32(checksum, block2, block2_len);