1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Introduce std::string_view into wider use (#14368)

This commit is contained in:
sfan5 2024-02-17 15:35:33 +01:00 committed by GitHub
parent fa47af737f
commit 6ca214fefc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 501 additions and 456 deletions

View file

@ -39,10 +39,9 @@ std::string translate_password(const std::string &name,
std::string slt = name + password;
SHA1 sha1;
sha1.addBytes(slt.c_str(), slt.length());
unsigned char *digest = sha1.getDigest();
std::string pwd = base64_encode(digest, 20);
free(digest);
sha1.addBytes(slt);
std::string digest = sha1.getDigest();
std::string pwd = base64_encode(digest);
return pwd;
}
@ -112,8 +111,8 @@ std::string encode_srp_verifier(const std::string &verifier,
{
std::ostringstream ret_str;
ret_str << "#1#"
<< base64_encode((unsigned char *)salt.c_str(), salt.size()) << "#"
<< base64_encode((unsigned char *)verifier.c_str(), verifier.size());
<< base64_encode(salt) << "#"
<< base64_encode(verifier);
return ret_str.str();
}