SHA256_PassHash confusing me. - 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: SHA256_PassHash confusing me. (
/showthread.php?tid=601456)
SHA256_PassHash confusing me. -
VivianKris - 21.02.2016
Код:
GetPlayerName(playerid, playerInfo[playerid][Name], MAX_PLAYER_NAME);
printf("%s\nA", playerInfo[playerid][Name]);
SHA256_PassHash(password, "ex", playerInfo[playerid][Password], MAX_PASSWORD_LENGTH);
printf("%s\nB", playerInfo[playerid][Name]);
new query[512];
mysql_format(mySQL, query, sizeof query, "INSERT INTO `accounts` (`name`, `password`, `cash`, `balance`, `positionx`, `positiony`, `positionz`, `health`) VALUES ('%e', '%s', '500', '1000', '1743.1606','-1864.1298','13.5742', '100.0')", playerInfo[playerid][Name], playerInfo[playerid][Password]);
mysql_tquery(mySQL, query);
printf("%s\n", query);
OUTPUT:
Код:
[23:36:56] Kris_Back
A
[23:36:56]
B
[23:36:56] INSERT INTO `accounts` (`name`, `password`, `cash`, `balance`, `positionx`, `positiony`, `positionz`, `health`) VALUES ('', 'D3B60247AFF81DB2C89AD6DC34C93AEE57F6A3D8FC68DD3A9EFFD1948E88C146', '500', '1000', '1743.1606','-1864.1298','13.5742', '100.0')
Why Name just emptied after SHA256_PassHash
Re: SHA256_PassHash confusing me. -
Vince - 21.02.2016
Inexplicable changes to variables are usually caused by buffer overflow. Make sure that the password length is at least 65. Not 64. You need the extra character for the null terminator.
Re: SHA256_PassHash confusing me. -
VivianKris - 21.02.2016
thx, fixed.