Making this hashed. - 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: Making this hashed. (
/showthread.php?tid=263348)
Making this hashed. -
gamerhead - 21.06.2011
Hello my system is a little bit unsafe for those who have the FTP.
They can read passwords.
This is the register hash, dini_Set(file,"Password",params); but how to make it a hashed pass in the .ini?
And when im logging in:
Код:
dcmd_login(playerid,params[])
{
new file[256],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"gio_admin/Users/%s.sav",n);
if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
if(PInfo[playerid][Regged] == 0) return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
if(strlen(params))
{
new pass[256];
pass = dini_Get(file,"Password");
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0)
{
SendClientMessage(playerid,YELLOW,"Wrong Password!");
}
else
{
dini_IntSet(file,"Logged",1);
PInfo[playerid][Logged] = 1;
PInfo[playerid][Level] = dini_Int(file,"Level");
SendClientMessage(playerid,YELLOW,"You have now logged in!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
return 1;
}
return 1;
}
Thanks for helping.
Re: Making this hashed. -
Babul - 21.06.2011
Код:
new PassWordStringInput[24];
new buffer[129];
new filename[32];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
if(!sscanf(inputtext,"s[24]",PassWordStringInput))
{
WP_Hash(buffer,sizeof(buffer),PassWordStringInput);
format(filename, sizeof(filename),"playerpasswords/%s.txt",Name);
new File:PWFile=fopen(filename,io_readwrite);
fwrite(PWFile,buffer);
fclose(PWFile);
}
thats not meant to correct your code, just read it - the hashing function is easier to use than you maybe think ^^
Re: Making this hashed. -
gamerhead - 22.06.2011
But its NOT an input. Otherwise i already had it hashed.
Its just /register pass and /login pass
Re: Making this hashed. -
Wesley221 - 22.06.2011
Then change the "inputtext" to "params", should work