mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Actually fix it, thanks to Zrax and Paradox
This commit is contained in:
@ -93,14 +93,11 @@ void CryptCreateRandomSeed(size_t length, uint8_t* data)
|
|||||||
|
|
||||||
void CryptHashPassword(const plString& username, const plString& password, ShaDigest dest)
|
void CryptHashPassword(const plString& username, const plString& password, ShaDigest dest)
|
||||||
{
|
{
|
||||||
/* This should be unnecessary once plString has ToLower() */
|
plStringStream buf;
|
||||||
wchar_t* w_name = (wchar_t*)_TEMP_CONVERT_TO_WCHAR_T(username);
|
buf << password.Left(password.GetSize() - 1) << '\0';
|
||||||
StrLower(w_name);
|
buf << username.ToLower().Left(username.GetSize() - 1) << '\0';
|
||||||
|
plStringBuffer<uint16_t> result = buf.GetString().ToUtf16();
|
||||||
plString buf = password;
|
plSHAChecksum sum(result.GetSize() * sizeof(uint16_t), (uint8_t*)result.GetData());
|
||||||
buf += _TEMP_CONVERT_FROM_WCHAR_T(w_name);
|
|
||||||
|
|
||||||
plSHAChecksum sum(buf.GetSize() * sizeof(wchar_t), (uint8_t*)_TEMP_CONVERT_TO_WCHAR_T(buf));
|
|
||||||
|
|
||||||
memcpy(dest, sum.GetValue(), sizeof(ShaDigest));
|
memcpy(dest, sum.GetValue(), sizeof(ShaDigest));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user