Nebula
Loading...
Searching...
No Matches
Util::Crc Class Reference

#include <crc.h>

Detailed Description

Compute CRC checksums over a range of memory.

Public Member Functions

 Crc ()
 constructor
 
void Begin ()
 begin computing a checksum
 
template<typename sizetype >
void Compute (unsigned char *buf, sizetype numBytes)
 continue computing checksum
 
void End ()
 finish computing the checksum
 
unsigned int GetResult () const
 get result
 

Private Attributes

bool inBegin
 
bool resultValid
 
unsigned int checksum
 

Static Private Attributes

static const unsigned int Key = 0x04c11db7
 
static const unsigned int NumByteValues = 256
 
static unsigned int Table [NumByteValues] = { 0 }
 
static bool TableInitialized = false
 

Constructor & Destructor Documentation

◆ Crc()

Util::Crc::Crc ( )

constructor

Member Function Documentation

◆ Begin()

void Util::Crc::Begin ( )

begin computing a checksum

Begin computing a CRC checksum over several chunks of data.

This can be done in multiple runs, which is the only useful way to compute checksum for large files.

◆ Compute()

template<typename sizetype >
void Util::Crc::Compute ( unsigned char * buf,
sizetype numBytes )

continue computing checksum

Do one run of checksum computation for a chunk of data.

Must be executed inside Begin()/End().

◆ End()

void Util::Crc::End ( )

finish computing the checksum

End checksum computation.

This validates the result, so that it can be accessed with GetResult().

◆ GetResult()

unsigned int Util::Crc::GetResult ( ) const

get result

Get the result of the checksum computation.

Must be executed after End().

Member Data Documentation

◆ checksum

unsigned int Util::Crc::checksum
private

◆ inBegin

bool Util::Crc::inBegin
private

◆ Key

const unsigned int Util::Crc::Key = 0x04c11db7
staticprivate

◆ NumByteValues

const unsigned int Util::Crc::NumByteValues = 256
staticprivate

◆ resultValid

bool Util::Crc::resultValid
private

◆ Table

unsigned int Util::Crc::Table = { 0 }
staticprivate

◆ TableInitialized

bool Util::Crc::TableInitialized = false
staticprivate

The documentation for this class was generated from the following files: