mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-14 04:11:37 -06:00
4.20
This commit is contained in:
committed by
Kornel Lesiński
parent
8c1b5c7b7e
commit
3c510ba80b
20
Common/CRC.h
20
Common/CRC.h
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user