Problem with strcmp
#1

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:
pawn Код:
if(strcmp(HashedInput, PlayerData[playerid][pPass]))
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.

pawn Код:
if(strcmp(HashedInput, PlayerData[playerid][pPass]))
    {
        SendClientMessage(playerid, Col_Green, "Correct.");
    }
    else
    {
        SendClientMessage(playerid, Col_Red, "Incorrect.");
    }
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.
Reply


Messages In This Thread
Problem with strcmp - by Finn707 - 28.08.2013, 16:53
Re: Problem with strcmp - by Konstantinos - 28.08.2013, 16:55
Re: Problem with strcmp - by Finn707 - 28.08.2013, 17:01

Forum Jump:


Users browsing this thread: 1 Guest(s)