blob: 86030e21060e741f37cf532232ef9b2b886fe9d4 (
plain)
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
|
#include "stdafx.h"
#include <xhash>
#include "Hasher.h"
Hasher::Hasher(wstring &salt)
{
this->salt = salt;
}
wstring Hasher::getHash(wstring &name)
{
// 4J Stu - Removed try/catch
//try {
wstring s = wstring( salt ).append( name );
//MessageDigest m;
//m = MessageDigest.getInstance("MD5");
//m.update(s.getBytes(), 0, s.length());
//return new BigInteger(1, m.digest()).toString(16);
// TODO 4J Stu - Will this hash us with the same distribution as the MD5?
return std::to_wstring(std::hash<wstring>{}( s ) );
//}
//catch (NoSuchAlgorithmException e)
//{
// throw new RuntimeException(e);
//}
}
|