template class Core::Portable::Crc

Overview

Generic class for computing cyclic redundancy checks. More…

#include <corecrc.h>

template <
    typename CrcType,
    CrcType polynomial,
    CrcType initialValue,
    bool reflectInput,
    bool reflectOutput,
    CrcType finalXorValue
>
class Crc
{
public:
    // methods

    void update(const void* data, int numBytes);
    CrcType get() const;
};

Detailed Documentation

Generic class for computing cyclic redundancy checks.

Usage:

Crc32 crc; while(receiveData (buffer, size)) crc.update (buffer, size); compare (crc.get (), expectedCrc);

See the explicit template initializations below for common CRC algorithms.

Methods

void update(const void* data, int numBytes)

Calculate the CRC value from a stream of bytes by calling update() for every new data packet.

CrcType get() const

Get the final CRC value.