
- Added SetCompressorDictSize (only works for LZMA) - Added SetCompressionLevel (only "works" for zlib and bzip2) - doesn't work for now - Section is only supposed to get 4 parameters if /o is specified - Updated version numbers git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3190 212acab6-be3b-0410-9dea-997c60f758d6
31 lines
629 B
C++
31 lines
629 B
C++
// Common/CRC.h
|
|
|
|
// #pragma once
|
|
|
|
#ifndef __COMMON_CRC_H
|
|
#define __COMMON_CRC_H
|
|
|
|
#include "Types.h"
|
|
|
|
class CCRC
|
|
{
|
|
UINT32 _value;
|
|
public:
|
|
static UINT32 Table[256];
|
|
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)
|
|
{
|
|
CCRC crc;
|
|
crc.Update(data, size);
|
|
return crc.GetDigest();
|
|
}
|
|
static bool VerifyDigest(UINT32 digest, const void *data, UINT32 size)
|
|
{
|
|
return (CalculateDigest(data, size) == digest);
|
|
}
|
|
};
|
|
|
|
#endif
|