Debian Codegraph @

Contrib/VPatch/Source/GenPat/Checksums.h

raw
1 //---------------------------------------------------------------------------
2 // Checksums.h
3 //---------------------------------------------------------------------------
4 // -=* VPatch *=-
5 //---------------------------------------------------------------------------
6 // Copyright (C) 2001-2005 Koen van de Sande / Van de Sande Productions
7 //---------------------------------------------------------------------------
8 // Website: http://www.tibed.net/vpatch
9 //
10 // This software is provided 'as-is', without any express or implied
11 // warranty. In no event will the authors be held liable for any damages
12 // arising from the use of this software.
13 //
14 // Permission is granted to anyone to use this software for any purpose,
15 // including commercial applications, and to alter it and redistribute it
16 // freely, subject to the following restrictions:
17 //
18 // 1. The origin of this software must not be misrepresented; you must not
19 // claim that you wrote the original software. If you use this software
20 // in a product, an acknowledgment in the product documentation would be
21 // appreciated but is not required.
22 // 2. Altered source versions must be plainly marked as such, and must not be
23 // misrepresented as being the original software.
24 // 3. This notice may not be removed or altered from any source distribution.
25 //
26 // Unicode support by Jim Park -- 08/29/2007
27
28 #if !defined(Checksums_H)
29 #define Checksums_H
30
31 #include "md5.h"
32 #include <string>
33 #include "GlobalTypes.h"
34 #include "tchar.h"
35
36 typedef uint32_t crc32_t;
37
38 class TChecksum {
39 public:
40 md5_byte_t digest[16];
41 crc32_t crc;
42 enum { CRC32, MD5 } mode;
43
44 TChecksum() : mode(MD5) { }
45 TChecksum(tstring& fileName);
46
47 void loadMD5(md5_byte_t newdigest[16]);
48 void loadCRC32(crc32_t newcrc);
49
50 bool operator==(const TChecksum& b);
51 };
52
53 #endif // Checksums_H