added client server login with hashed passwords and usernames

This commit is contained in:
Sem van der Hoeven
2020-10-02 11:43:07 +02:00
parent 3e5f6e46c4
commit fedf8c0e5b
4 changed files with 33 additions and 47 deletions

View File

@@ -38,8 +38,8 @@ namespace Client
private void retryEngineConnection()
{
Console.WriteLine("Could not connect to the VR engine. Please make sure you are running the simulation!");
Console.WriteLine("Press any key to retry connection");
Console.WriteLine("-- Could not connect to the VR engine. Please make sure you are running the simulation!");
Console.WriteLine("-- Press any key to retry connecting to the VR engine.");
Console.ReadKey();
engineConnection.CreateConnection();
@@ -92,6 +92,7 @@ namespace Client
if (responseStatus == "OK")
{
this.connected = true;
initEngine();
}
else
{
@@ -158,13 +159,12 @@ namespace Client
Console.WriteLine("enter password");
string password = Console.ReadLine();
string hashUser = Hashing.Hasher.Encrypt(username);
string hashPassword = Hashing.Hasher.Encrypt(password);
Console.WriteLine("hashed to " + hashUser + " " + hashPassword);
string hashUser = Hashing.Hasher.HashString(username);
string hashPassword = Hashing.Hasher.HashString(password);
byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(hashUser, hashPassword));
initEngine();
this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
}
}

View File

@@ -167,7 +167,7 @@ namespace Client
stream.Write(res);
Write("sent message " + message);
//Write("sent message " + message);
}
public void Write(string msg)
{