How to use SHA256 in UCP Login on PHP?
#1

Ok so i'm having this hash function on sa-mp


Код:
new MyHash[256];
SHA256_PassHash(inputtext, "78sdjs86d2h", MyHash, sizeof(MyHash));
if(!strcmp(MyHash, PlayerInfo[playerid][pKey]))
I assume 78sdjs86d2h is the salt, but the question is how do i set the salt in php ?

Right now i did this and seems to work, it hash but not with my salt...

Код HTML:
if(isset($_POST['username']) && isset($_POST['password'])){
	
	mysql_query('SET NAMES utf8');
	$var = mysql_real_escape_string("\xbf\x27 OR 1=1 /*");

	$username = mysql_real_escape_string($_POST['username']);
	$parola = mysql_real_escape_string($_POST['password']);
	$hash = hash('sha256', $parola);
	
	$check = get_row("SELECT ID FROM players WHERE Name='$username' && password='$hash' LIMIT 1");
	if(isset($check['ID']))
	{
		$_SESSION['username'] = $_POST['username'];
		$_SESSION['password'] = $_POST['password'];
		$id = $check['ID'];
		header("location: index.php");
	}
	else
	{
		printf("%s", $hash);

		$err = 'Username sau parola incorecte';
	}
}
How do i make it to hash with my own salt ?
Reply


Messages In This Thread
How to use SHA256 in UCP Login on PHP? - by Metharon - 02.03.2016, 21:16
Re: How to use SHA256 in UCP Login on PHP? - by Metharon - 02.03.2016, 21:27
Re: How to use SHA256 in UCP Login on PHP? - by Metharon - 03.03.2016, 13:15

Forum Jump:


Users browsing this thread: 1 Guest(s)