Skip to content

Commit

Permalink
Merge pull request #1445 from zrax/empty_pw_compat
Browse files Browse the repository at this point in the history
Fix an unlikely corner case of backwards compatibility with older clients
  • Loading branch information
zrax authored Aug 1, 2023
2 parents 6a7b75b + fb101d3 commit 98b49a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Plasma/NucleusLib/pnEncryption/plChallengeHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ void CryptCreateRandomSeed(size_t length, uint8_t* data)
void CryptHashPassword(const ST::string& username, const ST::string& password, ShaDigest dest)
{
ST::string_stream buf;
buf << password.left(password.size() - 1) << '\0';
buf << username.to_lower().left(username.size() - 1) << '\0';
if (!password.empty())
buf << password.left(password.size() - 1) << '\0';
if (!username.empty())
buf << username.to_lower().left(username.size() - 1) << '\0';
ST::utf16_buffer result = buf.to_string().to_utf16();
plSHAChecksum sum(result.size() * sizeof(char16_t), (uint8_t*)result.data());

Expand Down

0 comments on commit 98b49a1

Please sign in to comment.