-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCrc32.h
More file actions
41 lines (28 loc) · 1.13 KB
/
Copy pathCrc32.h
File metadata and controls
41 lines (28 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
NS_BEGIN
//#################################################################################################
class CCrc32 final
{
public:
explicit CCrc32(const uint32_t nPolynomial = 0xEDB88320);
bool Crc32File(PCNSTR szFilename, uint32_t &nCrc32) const;
bool Crc32Buffer(PCBYTE pBuffer, const size_t nSize, uint32_t &nCrc32) const;
bool Crc32StreamInit(uint32_t &nCrc32) const noexcept;
void Crc32Stream(PCBYTE pBuffer, const size_t nSize, uint32_t &nCrc32) const noexcept;
static void Crc32StreamEnd(uint32_t &nCrc32) noexcept;
private:
std::unique_ptr<uint32_t[]> m_pnCrc32Table;
};
//#################################################################################################
class CCrc32Mpeg2 final
{
public:
CCrc32Mpeg2(void);
bool Crc32File(PCNSTR szFilename, uint32_t &nCrc32) const;
bool Crc32Buffer(PCBYTE pBuffer, const size_t nSize, uint32_t &nCrc32) const;
static bool Crc32StreamInit(uint32_t &nCrc32) noexcept;
void Crc32Stream(PCBYTE pBuffer, const size_t nSize, uint32_t &nCrc32) const noexcept;
private:
std::unique_ptr<uint32_t[]> m_pnCrc32Table;
};
NS_END