QTfrontend/net/newnetclient.cpp
changeset 10076 b235e520ea21
parent 10074 66cab76eb56f
child 10108 c68cf030eded
--- a/QTfrontend/net/newnetclient.cpp	Sun Jan 26 00:09:50 2014 +0400
+++ b/QTfrontend/net/newnetclient.cpp	Sun Jan 26 02:17:04 2014 +0400
@@ -239,7 +239,7 @@
 void HWNewNet::SendPasswordHash(const QString & hash)
 {
     // don't send it immediately, only store and check if server asked us for a password
-    m_passwordHash = hash;
+    m_passwordHash = hash.toAscii();
 
     maybeSendPassword();
 }
@@ -311,7 +311,7 @@
             return;
         }
 
-        if(lst[2] != m_serverHash)
+        if(lst[1] != m_serverHash)
         {
             Error("Server authentication error");
             Disconnect();
@@ -1145,15 +1145,13 @@
     if(m_passwordHash.isEmpty() || m_serverSalt.isEmpty())
         return;
 
-    QString hash;
-
-    hash = QCryptographicHash::hash(
+    QString hash = QCryptographicHash::hash(
                 m_clientSalt.toAscii()
                 .append(m_serverSalt.toAscii())
                 .append(m_passwordHash)
                 .append(cProtoVer->toAscii())
                 .append("!hedgewars")
-                , QCryptographicHash::Sha1);
+                , QCryptographicHash::Sha1).toHex();
 
     m_serverHash = QCryptographicHash::hash(
                 m_serverSalt.toAscii()
@@ -1161,7 +1159,7 @@
                 .append(m_passwordHash)
                 .append(cProtoVer->toAscii())
                 .append("!hedgewars")
-                , QCryptographicHash::Sha1);
+                , QCryptographicHash::Sha1).toHex();
 
     RawSendNet(QString("PASSWORD%1%2%1%3").arg(delimeter).arg(hash).arg(m_clientSalt));
 }