Nebula
Loading...
Searching...
No Matches
crc.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "core/types.h"
13
14//------------------------------------------------------------------------------
15namespace Util
16{
17class Crc
18{
19public:
21 Crc();
23 void Begin();
25 template<typename sizetype> void Compute(unsigned char* buf, sizetype numBytes);
27 void End();
29 unsigned int GetResult() const;
30
31private:
32 static const unsigned int Key = 0x04c11db7;
33 static const unsigned int NumByteValues = 256;
34 static unsigned int Table[NumByteValues];
35 static bool TableInitialized;
36
37 bool inBegin;
39 unsigned int checksum;
40};
41
42//template<> void Crc::Compute(unsigned char* buf, int numBytes);
43//template<> void Crc::Compute(unsigned char* buf, __int64 numBytes);
44} // namespace Util
45//------------------------------------------------------------------------------
Compute CRC checksums over a range of memory.
Definition crc.h:18
static bool TableInitialized
Definition crc.h:35
unsigned int GetResult() const
get result
Definition crc.cc:101
static const unsigned int NumByteValues
Definition crc.h:33
void Compute(unsigned char *buf, sizetype numBytes)
continue computing checksum
Definition crc.cc:70
bool resultValid
Definition crc.h:38
bool inBegin
Definition crc.h:37
void Begin()
begin computing a checksum
Definition crc.cc:55
unsigned int checksum
Definition crc.h:39
void End()
finish computing the checksum
Definition crc.cc:88
Crc()
constructor
Definition crc.cc:20
static const unsigned int Key
Definition crc.h:32
static unsigned int Table[NumByteValues]
Definition crc.h:34
A pinned array is an array which manages its own virtual memory.
Definition String.cs:6