summaryrefslogtreecommitdiff
path: root/src/md5.cpp
blob: 4da0152b4d19b53c33b58ac44cd1e1914e37cd71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "md5.h"

namespace Multihash {
	MD5::MD5(Hash* n) : Hash(n) {
		MD5_Init(&md5_ctx);
	}
	
	void MD5::hash_update(const char* data, int length) {
		MD5_Update(&md5_ctx, data, length);
	}
	
	std::string MD5::hash_digest() {
		char digest[16];
		MD5_Final((unsigned char*)digest, &md5_ctx);
		return Hex::hex(digest, 16);
	}
}