SA-MP Forums Archive
Password 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)
+--- Thread: Password Hashing (/showthread.php?tid=568690)



Password Hashing - nicholasramdhan - 24.03.2015

How do I stop the passwords from hashing?
Like, how can I see the actual password in the scriptfiles folder when I click on the players name.
In other words, is there something else I can replace the udb_hash with to make it not hash(encrypt) out the players password?

Here's some code:
Код:
stock udb_hash(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;
}
Код:
	if(dialogid == 20)
 	{
  		if(!response) return Kick (playerid);
    	if(response)
     	{
      		if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
        	{
        	    new string[128];
         		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
           		GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
             	format(string, sizeof(string), "System: Welcome back to Gangwar Deathmatch, %s.", PlayerName(playerid));
             	SendClientMessage(playerid, COLOR_WHITE,string);
				LoggedIn[playerid] = 1;
         	}
          	else
           	{
            	ShowPlayerDialog(playerid,20,DIALOG_STYLE_PASSWORD,"Login",""BR"You have entered an Incorrect Password.\n"LB"Please try again.","Login","Exit");
            }
            return 1;
        }
Код:
       	INI_WriteInt(File,"Password", PlayerInfo[playerid][pPass] = udb_hash(inputparam));



Re: Password Hashing - Smileys - 24.03.2015

just remove the udb_hash functions in the register and login dialogs.

However I highly recommend you to encrypt your passwords, although udb_hash is pretty crappy, use Whirlpool instead!


Re: Password Hashing - nicholasramdhan - 24.03.2015

Thank you but honestly I have no idea how to switch it, if you have the time, can you help me please?


Re: Password Hashing - X337 - 24.03.2015

You wanna keylog other players password huh?


Re: Password Hashing - Mya - 24.03.2015

Quote:
Originally Posted by bondowocopz
Посмотреть сообщение
You wanna keylog other players password huh?
Yeah, you right huh xD


Re: Password Hashing - JaydenJason - 24.03.2015

Why do you even want to stop the passwords from being hashed?


Re: Password Hashing - nicholasramdhan - 24.03.2015

I want to try it because the fact that everytime I restart the server, I have to clear the users because the passwords get bugged. It was just an idea lol.


Re: Password Hashing - Sew_Sumi - 24.03.2015

Quote:
Originally Posted by nicholasramdhan
Посмотреть сообщение
I want to try it because the fact that everytime I restart the server, I have to clear the users because the passwords get bugged.
You wanna fix the bugs rather than work around them... If you don't fix the bugs you have, you'll end up with more, in other areas, that will take longer to find because you've worked-around them in the past.

It's better to actually fix the problem, than chuck band-aid on it, for a temp fix...


What you should really be asking is why, when you restart the server, would the users passwords, not work.

Are the user accounts working on relogging? and not just when the server restarts...


Re: Password Hashing - SickAttack - 24.03.2015

Cut the slack and follow a tutorial: https://sampforum.blast.hk/showthread.php?tid=273088 - That's the reason they are there, right? But there's no harm to ask for help, but don't you dare to remove the hashes!