SA-MP Forums Archive
Whirpool plugin - +rep. - 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: Whirpool plugin - +rep. (/showthread.php?tid=330697)



Whirpool plugin - +rep. - _DownLoaD_ - 02.04.2012

today i installed Whirpool, and the hash working fine, but i can get the correct(real) password ..
on Register:
pawn Код:
dini_Set(PlayerFile(playerid),"Password",Use_Hash(inputtext));
On Login:
pawn Код:
if(!strcmp(dini_Get(PlayerFile(playerid),"Password"),Use_Hash(inputtext),false))
Use_Hash stock:
pawn Код:
native WP_Hash(buffer[], len, const str[]); //By ******
stock Use_Hash(password[]) //By SiX_MiX
{
    new String[1024];
    WP_Hash(String,sizeof(String),password);
    return String;
}



Re: Whirpool plugin - +rep. - blank. - 02.04.2012

So you can or can't get the correct password?


Re: Whirpool plugin - +rep. - _DownLoaD_ - 02.04.2012

I can't..


Re: Whirpool plugin - +rep. - Virtual1ty - 02.04.2012

The thing with hashing is, once you hash that plain-text password, there's no way you can get it back, that's what hashing is for.
To compare the saved hashed password with what player inputted in lets say a dialog, you need to hash that plain-text password again, and compare it with the saved hashed password.
Also, in your Use_Hash stock, why are you wasting memory with such a large array?
pawn Код:
new String[129];
would the job just fine as it is the length of a Whirlpool hash, it says so in the release topic!


Re: Whirpool plugin - +rep. - _DownLoaD_ - 02.04.2012

how i can fix it?


Re: Whirpool plugin - +rep. - Reklez - 02.04.2012

pawn Код:
if(!strcmp(dini_Get(PlayerFile(playerid),"Password"),true)) //checks if the password is correct
{
//codes
} else { //checks if the password is wrong
//codes
}
i cannot get more info because i don't use dini anymore


Re: Whirpool plugin - +rep. - Virtual1ty - 02.04.2012

Quote:
Originally Posted by _DownLoaD_
Посмотреть сообщение
how i can fix it?
Debug the code. I don't use Dini neither, and I suggest you not to use it too, it's slow and inefficient!
By debugging the code I mean see where it fails. You might wanna start with that login check:
pawn Код:
if(!strcmp(dini_Get(PlayerFile(playerid),"Password"),Use_Hash(inputtext),false))
Example:
pawn Код:
new
    szPassword[256],
    szHash[129];
format(szPassword, 256, "%s", dini_Get(PlayerFile(playerid),"Password"));
format(szHash, 129, "%s", Use_Hash(inputtext));

printf("debug: Password from file:\n%s\nInput password:\n%s", szPassword, szHash);

// Rest..
if(!strcmp(dini_Get(PlayerFile(playerid),"Password"),Use_Hash(inputtext),false))



Re: Whirpool plugin - +rep. - _DownLoaD_ - 02.04.2012

Not Working yet.


Re: Whirpool plugin - +rep. - _DownLoaD_ - 02.04.2012

JUMP...


Re: Whirpool plugin - +rep. - iPLEOMAX - 02.04.2012

Check what is the length of buffer string in DINI Read... If that's shorter than 129, it'll probably return wrong hashes from file.

Open up dini.inc

--

Or compare the returned hash and the saved hash by printing them in console log..