Whirpool Hashing - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whirpool Hashing (
/showthread.php?tid=189724)
Whirpool Hashing -
LightFight™ - 13.11.2010
Hey,
I have got a problem with Whirpool.
It works great when I register, but it would not let me login.
These are three versions I tried:
___________________________________________
pawn Код:
/*THIS ONE REDIRECTS ME TO PASSWORD DOES NOT MATCH ( }else{ )*/
new buf[129];
WP_Hash(buf, sizeof (buf), inputtext);
if(strcmp(pass, buf, true))
{
/*CORRECT PASSWORD*/
}
pawn Код:
/*THIS ONE REDIRECTS ME TO PASSWORD DOES NOT MATCH TOO ( }else{ )*/
new buf[129];
WP_Hash(buf, sizeof (buf), inputtext);
if(strcmp(buf, pass, true))
{
/*CORRECT PASSWORD*/
}
pawn Код:
/*HERE THE DIALOG JUST DISAPPEARS (No action taken)*/
new buf[129];
WP_Hash(buf, sizeof (buf), inputtext);
if(!strcmp(buf, pass, true))
{
/*CORRECT PASSWORD*/
}
Any ideas?
- Thanks
EDIT: pass and MySQL password field are defined as 128.
Re: Whirpool Hashing -
iggy1 - 13.11.2010
What does "pass" hold?, obviously a password but how do you assign it?
Re: Whirpool Hashing -
Retardedwolf - 13.11.2010
It should be the last one. maybe try just removing the true part.
pawn Код:
if ( !strcmp ( buf, pass ) )
Re: Whirpool Hashing -
LightFight™ - 13.11.2010
Yeah, I forgot to add.
The original post is edited now.
The Database and "pass" are both 128.
Re: Whirpool Hashing -
iggy1 - 13.11.2010
I don't mean the size, i mean what string do they hold? how do you put the string into "pass"?
Is pass an empty array?, is what i mean.
File system maybe?
buff = inputtext
pass = ?
Re: Whirpool Hashing -
LightFight™ - 13.11.2010
Quote:
Originally Posted by iggy1
I don't mean the size, i mean what string do they hold? how do you put the string into "pass"?
Is pass an empty array?, is what i mean.
File system maybe?
|
It writes everything correctly into the Database:
FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE892 3B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701 A4FCFB248FA7FA77B95180628BB2
Re: Whirpool Hashing -
iggy1 - 13.11.2010
Do you actually put that string into pass?
Re: Whirpool Hashing -
LightFight™ - 13.11.2010
Quote:
Originally Posted by iggy1
Do you actually put that string into pass?
|
This string is saved into the Database after being hash by Whirpool.
What I trying to do is - unhash this string correctly to be able to login.
EDIT: And yes, it does SELECT * FROM to get "pass"
Re: Whirpool Hashing -
LightFight™ - 13.11.2010
This is how I get "pass"
pawn Код:
format(MySQL, sizeof(MySQL), "SELECT * FROM `Accounts` WHERE `User` = '%s' AND `Password` = '%s'", dUser, pass);
Re: Whirpool Hashing -
Slice - 13.11.2010
Quote:
Originally Posted by LightFight™
This is how I get "pass"
pawn Код:
format(MySQL, sizeof(MySQL), "SELECT * FROM `Accounts` WHERE `User` = '%s' AND `Password` = '%s'", dUser, pass);
|
You could do:
pawn Код:
format(MySQL, sizeof(MySQL), "SELECT COUNT(*) FROM `Accounts` WHERE `User` = '%s' AND `Password` = '%s'", dUser, pass);
Then simply check if count equals 1.