SHA256_PassHash confusing me.
#1

Код:
    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
Reply
#2

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.
Reply
#3

thx, fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)