mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Fixed the password crash on Windows
This commit is contained in:
parent
bbead93c1a
commit
51cf464f74
5 changed files with 18 additions and 8 deletions
|
@ -229,10 +229,10 @@ std::string translatePassword(std::string playername, std::wstring password)
|
|||
if(password.length() == 0)
|
||||
return "";
|
||||
|
||||
std::string slt=playername + wide_to_narrow(password);
|
||||
SHA1 *sha1 = new SHA1();
|
||||
sha1->addBytes(slt.c_str(), slt.length());
|
||||
unsigned char *digest = sha1->getDigest();
|
||||
std::string slt = playername + wide_to_narrow(password);
|
||||
SHA1 sha1;
|
||||
sha1.addBytes(slt.c_str(), slt.length());
|
||||
unsigned char *digest = sha1.getDigest();
|
||||
std::string pwd = base64_encode(digest, 20);
|
||||
free(digest);
|
||||
return pwd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue