28.08.2013, 16:53
Okay, when someone enters a password in the login dialog, the server will get the players salt (stored in a pSalt enum) and get the inputtext and format them together. The server then uses Whirlpool to hash the salt and password together. I then have this line:
Obviously, HashedInput is the salted and hashed inputtext, and pPass is the actual password from the database. I used print(PlayerData[playerid][pSalt]); to make sure pPass was correct, and it was.
The problem is that when I type an incorrect password, the server thinks that it is correct.
In theory, this piece of code should check if HashedInput and pPass are the same, and if they are, it should say "Correct", and if they're not the same it should say "Incorrect.", right? Well that's not what it's doing. Whatever I write as the password it will say it's correct.
pawn Код:
if(strcmp(HashedInput, PlayerData[playerid][pPass]))
The problem is that when I type an incorrect password, the server thinks that it is correct.
pawn Код:
if(strcmp(HashedInput, PlayerData[playerid][pPass]))
{
SendClientMessage(playerid, Col_Green, "Correct.");
}
else
{
SendClientMessage(playerid, Col_Red, "Incorrect.");
}