SA-MP Forums Archive
Password hash issue (Whirlpool) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Password hash issue (Whirlpool) (/showthread.php?tid=325697)



Password hash issue (Whirlpool) - sim_sima - 14.03.2012

As a part of a login/register system, I am chhanging from dudb hash function to Whirlpool.
I get only one error that I dont know how to fix.

The code part looks like this:
pawn Code:
Line 143: new hashed_password[129];
Line 144: WP_Hash(hashed_password, sizeof(hashed_password), inputtext);
Line 145: djSetInt(file, "Password", hashed_password);
The error code I get is this:
Code:
C:\Users\Simon\Desktop\samp server\gamemodes\rpg.pwn(145) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Hope someone can help me, its very simple, I gues.
Thank you.


Re: Password hash issue (Whirlpool) - T0pAz - 14.03.2012

Show this function djSetInt.


Re: Password hash issue (Whirlpool) - sim_sima - 14.03.2012

Quote:
Originally Posted by T0pAz
View Post
Show this function djSetInt.
That function just sets an integer into a json file.
I am using djson to save user data.


Re: Password hash issue (Whirlpool) - T0pAz - 14.03.2012

Quote:
Originally Posted by sim_sima
View Post
That function just sets an integer into a json file.
I am using djson to save user data.
I guess it would be a djSetString(Never used djSon).


Respuesta: Password hash issue (Whirlpool) - kirk - 14.03.2012

The output of a hashed password its not an integer its an string.

So switch to the other functiont that sets strings instead of integers.


Re: Respuesta: Password hash issue (Whirlpool) - sim_sima - 14.03.2012

Quote:
Originally Posted by kirk
View Post
The output of a hashed password its not an integer its an string.

So switch to the other functiont that sets strings instead of integers.
Oh thanks. Ill try.


Respuesta: Password hash issue (Whirlpool) - kirk - 14.03.2012

Quote:
Originally Posted by sim_sima
View Post
The code part looks like this:
pawn Code:
Line 143: new hashed_password[129];
[/code]
Aswell you declared a string of 129 cells over there, it should work.


Re: Password hash issue (Whirlpool) - sim_sima - 14.03.2012

Thanks guys, it works now. But i just ran into another problem with whirlpool.
When the player has to log in, this code is executed:
pawn Code:
if(dialogid == 2)
    {
        if(!response)
        {
            StopAudioStreamForPlayer(playerid);
            SendClientMessage(playerid, COLOR_SYSTEMRED, "( ! ) You must log in to play on this server. Please come again soon");
            Kick(playerid);
            gPlayerLogged[playerid] = 0;
        }
        new tmp, hashed_password[129];
        tmp = dj(file, "Password");
        WP_Hash(hashed_password, sizeof(hashed_password), inputtext);
        if(hashed_password != tmp)
        {
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{FFFF00}Hopes Hills RPG Account", "{AF0000}Incorrect Password!\n{FFFFFF}Enter your Password", "Login", "Quit");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREEN, "( ! ) You have successfully Logged In!");
            GivePlayerMoney(playerid, djInt(file, "Money"));
            PlayerInfo[playerid][pBanned] = djInt(file, "Banned");
            LoadUserData(playerid);
            gPlayerLogged[playerid] = 1;
            OnceLogged[playerid] = 1;
        }
But I get these errors:
Code:
C:\Users\Simon\Desktop\samp server\gamemodes\rpg.pwn(175) : error 006: must be assigned to an array
C:\Users\Simon\Desktop\samp server\gamemodes\rpg.pwn(178) : error 033: array must be indexed (variable "hashed_password")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Hope you can help. Thanks.


Respuesta: Password hash issue (Whirlpool) - kirk - 14.03.2012

Declare tmp as a 129 cells string, if i were you i would use strcmp() to compare two strings.