Password hash issue (Whirlpool)
#1

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.
Reply
#2

Show this function djSetInt.
Reply
#3

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.
Reply
#4

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).
Reply
#5

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.
Reply
#6

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.
Reply
#7

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.
Reply
#8

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.
Reply
#9

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


Forum Jump:


Users browsing this thread: 6 Guest(s)