24 lines
465 B
C++
24 lines
465 B
C++
#pragma once
|
|
|
|
#include "AbstractChecksumCalculator.h"
|
|
|
|
#include <vector>
|
|
|
|
class CyclicRedundancyChecker : public AbstractChecksumCalculator
|
|
{
|
|
public:
|
|
void addValue(unsigned char val) override;
|
|
|
|
uint32_t getChecksum() const override;
|
|
|
|
void reset() override;
|
|
|
|
private:
|
|
void createTable();
|
|
bool mTableComputed{false};
|
|
|
|
uint32_t mLastValue{0xffffffffL};
|
|
|
|
static const std::size_t TABLE_SIZE{ 256 };
|
|
std::vector<unsigned long> mTable;
|
|
};
|