xoreos  0.0.5
md5.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef COMMON_MD5_H
26 #define COMMON_MD5_H
27 
28 #include <vector>
29 
30 #include "src/common/types.h"
31 
32 namespace Common {
33 
34 class UString;
35 class ReadStream;
36 
38 static const size_t kMD5Length = 16;
39 
41 void hashMD5(ReadStream &stream, std::vector<byte> &digest);
43 void hashMD5(const byte *data, size_t dataLength, std::vector<byte> &digest);
45 void hashMD5(const UString &string, std::vector<byte> &digest);
47 void hashMD5(const std::vector<byte> &data, std::vector<byte> &digest);
48 
50 bool compareMD5Digest(ReadStream &stream, const std::vector<byte> &digest);
52 bool compareMD5Digest(const byte *data, size_t dataLength, const std::vector<byte> &digest);
54 bool compareMD5Digest(const UString &string, const std::vector<byte> &digest);
56 bool compareMD5Digest(const std::vector<byte> &data, const std::vector<byte> &digest);
57 
58 } // End of namespace Common
59 
60 #endif // COMMON_MD5_H
void hashMD5(ReadStream &stream, std::vector< byte > &digest)
Hash the stream into an MD5 digest of 16 bytes.
Definition: md5.cpp:248
Generic interface for a readable data stream.
Definition: readstream.h:64
Definition: 2dafile.h:39
A class holding an UTF-8 string.
Definition: ustring.h:48
Low-level type definitions to handle fixed width types portably.
bool compareMD5Digest(ReadStream &stream, const std::vector< byte > &digest)
Hash the stream and compare the digests, returning true if they match.
Definition: md5.cpp:280
static const size_t kMD5Length
The length of an MD5 digest in bytes.
Definition: md5.h:38
uint8 byte
Definition: types.h:209