32 #ifndef CRC32CheckSum_INCLUDE_ONCE 33 #define CRC32CheckSum_INCLUDE_ONCE 45 static const int CHUNK_SIZE = 128*1024;
53 const unsigned char* buffer = (
const unsigned char*)buf;
57 return mCRC32 ^ 0xffffffff;
62 std::vector<unsigned char> buffer;
63 buffer.resize(CHUNK_SIZE);
64 unsigned char *ptr = &buffer.front();
85 unsigned int ulPolynomial = 0x04c11db7;
86 for(
int i = 0; i <= 0xFF; i++)
89 for (
int j = 0; j < 8; j++)
95 unsigned int reflect(
unsigned int val,
char ch)
97 unsigned int refl = 0;
98 for(
int i = 1; i < (ch + 1); i++)
101 refl |= 1 << (ch - i);
long long read(void *buffer, long long byte_count)
Reads byte_count bytes from a file. Returns the number of bytes actually read.
unsigned int compute(const void *buf, int length)
Computes the a CRC32 checksum of a given buffer or VirtualFile.
An abstract class representing a file.
unsigned int crc32_table[256]
unsigned int finalizeCRC32()
unsigned int reflect(unsigned int val, char ch)
Visualization Library main namespace.
void continueCRC32(unsigned char *ptr, int length)
unsigned int compute(VirtualFile *stream)
CRC32CheckSum()
Constructor.