SA-MP Forums Archive
False login problem - 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: False login problem (/showthread.php?tid=646833)



False login problem - EmpireSk - 24.12.2017

Hi guys... Why when I enter the correct password, it will show me that I have a bad password


Код HTML:
case DIALOG_LOGIN:
		{
			if ( !response ) return SetTimerEx("KickPublic", 1500, 0, "d", playerid);
			if( response )
			{
				if(!fexist(UserPath(playerid))) return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Přihlбљenн","{ff0000}ERROR:\nNastala chyba so sъbormy !\nSъbor na zapisovanie dбt pre tento ъčet nieje vytvorenэ !!!\n\n{ffffff}Před vstupem do hry se musнљ nejdřнve přihlбsit\nZadej svй heslo:","Potvrdit","");
				else if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Přihlбљenн","{ff0000}Nezadal si heslo !\n{ffffff}Před vstupem do hry se musнљ nejdřнve přihlбsit\nZadej svй heslo:","Potvrdit","");
				else if(strcmp(DOF2_GetString(UserPath(playerid),"Password"),lyrhash(inputtext),true))
				{
					PlayerInfo[playerid][FalseLogin]++;

					if(PlayerInfo[playerid][FalseLogin]<=2)
					{
						new Text2f[256];
						format(Text2f,256,"{ff0000}Љpatnй heslo ! (Warning: %d/3)\n{ffffff}Před vstupem do hry se musнљ nejdřнve přihlбsit\nZadej svй heslo:",PlayerInfo[playerid][FalseLogin]);
						ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Přihlбљenн",Text2f,"Potvrdit","");
					}
					else
					{
						SendClientMessage(playerid,COLOR_WARNING,"Љpatnй heslo ! (Warning 3/3)");
						SetTimerEx("KickPublic", 1500, 0, "d", playerid);
					}
				}
				else
				{

                                        PlayerInfo[playerid][Admin] = DOF2_GetInt( UserPath(playerid),"Admin");
					PlayerInfo[playerid][Gender] = DOF2_GetInt( UserPath(playerid),"Origin");
                                        .............................................. .. . 



Re: False login problem - Abagail - 24.12.2017

What is the lyrhash function? (I'm assuming it's some type of password hash, but I've never heard of it).


Re: False login problem - EmpireSk - 24.12.2017

Lyrhash?
It's like Whirpool


PHP код:
stock lyrhash(what[])
{
    new 
newstr[129];
    new 
out[129];
    new 
deflen strlen(what);
    new 
newlen deflen;
    new 
changeval[3] = {0, -11};
    
format(newstr129"%c%s"1what);
    while(
newlen 128)
    {
        
newstr[newlen] = newstr[newlen % (deflen 1)];
        
newlen++;
    }
    for(new 
i=0i<128i++) changeval[0] += newstr[i];
    
changeval[1] -= (changeval[0] % 100) + newstr[deflen 128];
    
changeval[2] = floatround(floatpower(changeval[0] % 216changeval[1] % 4));
    for(new 
i=0i<128i++)
    {
        
out[i] = 65 + ((changeval[0] + changeval[1] + changeval[2]) % 26);
        
changeval[0] -= changeval[1];
        
changeval[1] -= i;
        
changeval[2] += changeval[0] % 5;
    }
    return 
out;

PHP код:
Password KORVYENATQVIELBEUYSAASDJIEXOFULEABFQIISKOEHZEANSRIVEKPRUYEOASQVJEKBEVYRAATDIIEYOEULFAAFQJIRKOFHYEAOSQIVFKORUZENASRVI 



Re: False login problem - RogueDrifter - 24.12.2017

Quote:
Originally Posted by EmpireSk
Посмотреть сообщение
Lyrhash?
It's like Whirpool


PHP код:
stock lyrhash(what[])
{
    new 
newstr[129];
    new 
out[129];
    new 
deflen strlen(what);
    new 
newlen deflen;
    new 
changeval[3] = {0, -11};
    
format(newstr129"%c%s"1what);
    while(
newlen 128)
    {
        
newstr[newlen] = newstr[newlen % (deflen 1)];
        
newlen++;
    }
    for(new 
i=0i<128i++) changeval[0] += newstr[i];
    
changeval[1] -= (changeval[0] % 100) + newstr[deflen 128];
    
changeval[2] = floatround(floatpower(changeval[0] % 216changeval[1] % 4));
    for(new 
i=0i<128i++)
    {
        
out[i] = 65 + ((changeval[0] + changeval[1] + changeval[2]) % 26);
        
changeval[0] -= changeval[1];
        
changeval[1] -= i;
        
changeval[2] += changeval[0] % 5;
    }
    return 
out;

PHP код:
Password KORVYENATQVIELBEUYSAASDJIEXOFULEABFQIISKOEHZEANSRIVEKPRUYEOASQVJEKBEVYRAATDIIEYOEULFAAFQJIRKOFHYEAOSQIVFKORUZENASRVI 
why not just hash-salt if you want something safe? i see the only reason to cause this would be the hashing you must load the password the same way it was saved.