This commit is contained in:
Igor Pavlov
2005-05-30 00:00:00 +00:00
committed by Kornel Lesiński
parent 8c1b5c7b7e
commit 3c510ba80b
926 changed files with 40559 additions and 23519 deletions

View File

@@ -1,7 +1,5 @@
// Common/CRC.h
// #pragma once
#ifndef __COMMON_CRC_H
#define __COMMON_CRC_H
@@ -9,20 +7,26 @@
class CCRC
{
UINT32 _value;
UInt32 _value;
public:
static UINT32 Table[256];
static UInt32 Table[256];
static void InitTable();
CCRC(): _value(0xFFFFFFFF){};
void Init() { _value = 0xFFFFFFFF; }
void Update(const void *data, UINT32 size);
UINT32 GetDigest() const { return _value ^ 0xFFFFFFFF; }
static UINT32 CalculateDigest(const void *data, UINT32 size)
void UpdateByte(Byte v);
void UpdateUInt16(UInt16 v);
void UpdateUInt32(UInt32 v);
void UpdateUInt64(UInt64 v);
void Update(const void *data, UInt32 size);
UInt32 GetDigest() const { return _value ^ 0xFFFFFFFF; }
static UInt32 CalculateDigest(const void *data, UInt32 size)
{
CCRC crc;
crc.Update(data, size);
return crc.GetDigest();
}
static bool VerifyDigest(UINT32 digest, const void *data, UINT32 size)
static bool VerifyDigest(UInt32 digest, const void *data, UInt32 size)
{
return (CalculateDigest(data, size) == digest);
}