-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathNSWFL_CRC32.H
43 lines (34 loc) · 1.75 KB
/
NSWFL_CRC32.H
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
42
43
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright © NetworkDLS 2023, All rights reserved
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef _NSWFL_CRC32_H_
#define _NSWFL_CRC32_H_
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace NSWFL {
namespace Hashing {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class CRC32 {
public:
CRC32(void);
~CRC32(void);
void Initialize(void);
bool FileCRC(const char* sFileName, unsigned int* iOutCRC);
bool FileCRC(const char* sFileName, unsigned int* iOutCRC, size_t iBufferSize);
unsigned int FileCRC(const char* sFileName);
unsigned int FileCRC(const char* sFileName, size_t iBufferSize);
unsigned int FullCRC(const unsigned char* sData, size_t iDataLength);
void FullCRC(const unsigned char* sData, size_t iLength, unsigned int* iOutCRC);
void PartialCRC(unsigned int* iCRC, const unsigned char* sData, size_t iDataLength);
private:
unsigned int Reflect(unsigned int iReflect, const char cChar);
unsigned int iTable[256]; // CRC lookup table array.
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} //namespace::Hashing
} //namespace::NSWFL
#endif