change pass
#1

when i use this code for change password given me [ERORR]:You have entered incorrect password.
how to fix it?


Код:
CMD:changepass(playerid, params[])
{
	new pass1[128],pass2[128];
    if(sscanf(params,"ii",pass1,pass2)) return SendClientMessage(playerid, COLOR_RED,CmdUsageText[50]);
    if(PlayerInfo[playerid][pPass2] != strval(pass1))return SendClientMessage(playerid, COLOR_RED,"[ERORR]:You have entered incorrect password.");
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Password",udb_hash(pass2));
	INI_WriteInt(File,"Password2",strval(pass2));
	INI_Close(File);
	new str[128];
	format(str, sizeof(str), "You have change your password to %d", pass2);
	SendClientMessage(playerid, COLOR_BLUE,str);
	return 1;
}
Reply
#2

udb_hash (a.k.a. Adler-32) is not a hashing algorithm and it is completely insecure. Stop using it. Use Whirlpool or sha2.
Reply
#3

First of all, you declared pass1 and pass2 as a string of length 128 chars, and while using sscanf to get them out of the command-parameters, you use them as if they were integers.

And checking if strings are equal, isn't done through "strval(string)", but you use "strcmp" for that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)