Y_ini and Whirlpool
#1

Hello everyone,

I have a strange problem with Y_INI and Whirlpool. every time Y_ini saves the hash it deletes the last character of the hash

this is my register command:
pawn Код:
YCMD:register(playerid, params[], help)
{
    if(help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Creates a account.");
    }
    if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)
    return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: You have already registered!");
    else if(!params[0])
    return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /register [password]");
    else if(strlen(params) < gSettings[PASS_MIN] || strlen(params) > gSettings[PASS_MAX])
    {
        new string[63];
        format(string, sizeof(string), "ERROR: Password must be between %d and %d characters long!", gSettings[PASS_MIN], gSettings[PASS_MAX]);
        return SendClientMessage(playerid, COLOR_ORANGE, string);
    }
        else
    {
        new buf[129];
        WP_Hash(buf, 129, params);
        format(gPlayerInfo[playerid][PLAYER_PASS], 129, "%s", buf);
        print(gPlayerInfo[playerid][PLAYER_PASS]);
        new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,sizeof pName);
        new file[37];
        format(file,sizeof file,PlayerFile,pName);
        new INI:handler = INI_Open(file);
        INI_WriteString(handler, "Pass", buf);
        INI_Close(handler);
        print(buf);
        gPlayerInfo[playerid][PLAYER_REGGED] = 1;
        gPlayerInfo[playerid][PLAYER_LOGGED] = 1;
        GetPlayerIp(playerid, gPlayerInfo[playerid][PLAYER_IP], 16);
        SaveUser(playerid);
        new string[128]; format(string, sizeof(string), "You have successfully registered your account with the password \'%s\'. You have been automatically logged in.", params);
        return SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
}
i hope one of you can help me with it, its really annoying cause the whole login system wont work now.

it works for a large part, but only this
Код:
CE4E7BFAC27A4BD5F015ADF67F0FA3072B9AF27774E1E14028E69B85858BC6116A02E67B985A97C07EC844B94DCD4F1C48F354AE19D588C512A3FA195082528A
becomes this

Код:
CE4E7BFAC27A4BD5F015ADF67F0FA3072B9AF27774E1E14028E69B85858BC6116A02E67B985A97C07EC844B94DCD4F1C48F354AE19D588C512A3FA195082528
Thanks in advance,

Sansko.
Reply
#2

Make the buff strings bigger then 129, also is it giving any errors or warnings?
Reply
#3

Use the "buf" variable instead of formating a string. Buf holds the hash, without the need of formatting.

EDIT, Scratch that i never realised you was using "buf" sorry.
Reply
#4

Quote:
Originally Posted by expertprogrammer
Посмотреть сообщение
Make the buff strings bigger then 129, also is it giving any errors or warnings?
Don't have too, ths string will be always 128 long + null terminator
Quote:
Originally Posted by iggy1
Посмотреть сообщение
Use the "buf" variable instead of formating a string. Buf holds the hash, without the need of formatting.

EDIT, Scratch that i never realised you was using "buf" sorry.
i tried to directly format it to gPlayerInfo[playerid][PLAYER_PASS] which is als 129 long,

Same result

it works for a large part only this
Код:
CE4E7BFAC27A4BD5F015ADF67F0FA3072B9AF27774E1E14028E69B85858BC6116A02E67B985A97C07EC844B94DCD4F1C48F354AE19D588C512A3FA195082528A
becomes this

Код:
CE4E7BFAC27A4BD5F015ADF67F0FA3072B9AF27774E1E14028E69B85858BC6116A02E67B985A97C07EC844B94DCD4F1C48F354AE19D588C512A3FA195082528
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)