02.03.2016, 21:16
Ok so i'm having this hash function on sa-mp
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...
How do i make it to hash with my own salt ?
Код:
new MyHash[256]; SHA256_PassHash(inputtext, "78sdjs86d2h", MyHash, sizeof(MyHash)); if(!strcmp(MyHash, PlayerInfo[playerid][pKey]))
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';
}
}

