Password Hashing
#1

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

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

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

You wanna keylog other players password huh?
Reply
#5

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

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

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

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)