07.03.2015, 14:21
So I'm using Whirpool to hash my passwords, and what I got for register works. It hashes the players password successfully. It will show up hashed in their userfile even after disconnect. For the instance of this thread we're going to be using the hash for '12345' as a password.
However, when I login; EVEN when I hash the inputtext to check if the password is correct. It says it is wrong. I've logged in before without the hash and it works perfectly. However, when I log in with the password hashed even with this code:
It says I have entered the wrong password. But even when I printf("%s", pwh); I get
And I also get the same hash in the playerfile, they match up. And when we switch to 'OnPlayerLoginAttempt', we compare the password with the one in the playerfile:
..halp. REP+
However, when I login; EVEN when I hash the inputtext to check if the password is correct. It says it is wrong. I've logged in before without the hash and it works perfectly. However, when I log in with the password hashed even with this code:
pawn Код:
case 3894:
{
if(strlen(inputtext) > 128 || strlen(inputtext) < 1)
{
new Sum, string[128];
Sum = 3-Player[playerid][LoginAttempts];
SendClientMessage(playerid, ADMINBLUE, "The password you have entered does not match your account. Please try again or use the forums.");
Player[playerid][LoginAttempts]++;
format(string, sizeof(string), "You have %d remaining login attempts, before you are auto-banned.", Sum);
SendClientMessage(playerid, WHITE, string);
ShowPlayerDialog(playerid, 3894, DIALOG_STYLE_INPUT, "Authentication", "Welcome to Peak Gaming Roleplay\n\nYou have an account, please enter your password to authenticate.", "Login", "Help");
}
else
{
if(Player[playerid][Authenticated] == 0)
{
new pwh[255];//Here it creates the carry-over
WP_Hash(pwh, sizeof (pwh), inputtext);//Here it hashes the password
OnPlayerLoginAttempt(playerid, pwh);//Here it sends the password to the public.
}
else
{
SendClientMessage(playerid, GREY, "You're already authenticated.");
}
}
}
Код:
CCE08BBA3F2E3C029CD257104B06D4B075772D5F514CF1B7789506F9A69D53C51464881D2C18445AB290553B302F67A24B1C69E3E737A46215DEAF43517E496
pawn Код:
public OnPlayerLoginAttempt(playerid, password[])
{
new string[128], Year, Month, Day, Minute, Hour, Second, Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string), "Accounts/%s.ini", Name);
if(Player[playerid][LoginAttempts] == 3)
{
new hour, minute, second, day, year, month;
gettime(hour, minute, second);
getdate(year, month, day);
#pragma unused second
new IP[21];
GetPlayerIp(playerid, IP, sizeof(IP));
format(string, sizeof(string), "%d/%d/%d | %d:%d | %s | %s | THREE FAILED PASSWORD ATTEMPTS | System", day, month, year, hour, minute, IP, Name);
BanLog(string);
SendClientMessage(playerid, ADMINBLUE, "You have used your three attempts.");
Ban(playerid);
}
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
if(fexist(string))
{
if(strcmp(dini_Get(string, "Password"), password, false) == 0)
{//Continues past this point but is long and useless.