Heavier password encryption
I don't think this fixes actual bugs but the encryption seemed kinda weak.
This commit is contained in:
@@ -62,11 +62,14 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
unauthenticatedClients.Remove(unauthenticatedClient);
|
||||
|
||||
NetEncryption algo = new NetXtea(server, password);
|
||||
string saltedPw = password;
|
||||
saltedPw = saltedPw + Convert.ToString(unauthenticatedClient.Nonce);
|
||||
saltedPw = Encoding.UTF8.GetString(NetUtility.ComputeSHAHash(Encoding.UTF8.GetBytes(saltedPw)));
|
||||
NetEncryption algo = new NetXtea(server, saltedPw);
|
||||
inc.Decrypt(algo);
|
||||
|
||||
int nonce = inc.ReadInt32();
|
||||
if (nonce != unauthenticatedClient.Nonce)
|
||||
string rdPw = inc.ReadString();
|
||||
if (rdPw != saltedPw)
|
||||
{
|
||||
inc.SenderConnection.Disconnect("Wrong password!");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user