Whirpool plugin - +rep.
#1

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;
}
Reply
#2

So you can or can't get the correct password?
Reply
#3

I can't..
Reply
#4

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!
Reply
#5

how i can fix it?
Reply
#6

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

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

Not Working yet.
Reply
#9

JUMP...
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)