Help with 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with Whirlpool (
/showthread.php?tid=252635)
Help with Whirlpool -
Osviux - 02.05.2011
Hi, i want to code my server user passwords by using Whirlpool, but i dont know how. I have downloaded Whirlpool succesfuly loaded it and put in the native.
I have tried this, but in the .ini file of a user it shows Password=0
Code:
if(dialogid == 0)
{
if(response)
{
new name[MAX_PLAYER_NAME],file[128];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"saves/user/%s.ini",name);
dini_Create(file);
new buffer[129];
dini_IntSet(file,"Password",WP_Hash(buffer, sizeof(buffer), inputtext));
format(file,sizeof(file),"{FF0000}MPG:{FFFF00} Jus uzregistruotas ir prijungtas, aciu kad pasirinkote {00FF00}MPGames {FF0000}(Password: %s)",inputtext);
SendClientMessage(playerid,GELTONA,file);
playerDB[playerid][authstate]=1;
return 1;
}
return 1;
}
return 1;
}
Re: Help with Whirlpool -
MadeMan - 02.05.2011
pawn Code:
WP_Hash(buffer, sizeof(buffer), inputtext);
dini_Set(file,"Password",buffer);
Re: Help with Whirlpool -
Osviux - 02.05.2011
Thanks, its coded now, and thats i big code

Im going to try to login now.
Re: Help with Whirlpool -
Osviux - 02.05.2011
It writes incorrect password. I found this what do i need to change?
Code:
stock tohash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
stock CheckPass(file[],password[])
{
if(dini_Int(file,"Password")==tohash(password)) return true;
return false;
}
Re: Help with Whirlpool -
MadeMan - 02.05.2011
pawn Code:
stock CheckPass(file[],password[])
{
new buffer[129];
WP_Hash(buffer, sizeof(buffer), password);
if(strcmp(dini_Get(file,"Password"), buffer) == 0) return true;
return false;
}
Re: Help with Whirlpool -
Osviux - 02.05.2011
Thank you, i tested everything and i can say that now the passwords are safe