Whirlpool registering
#1

I'm using MySQL to save data and tried to hash the password using Whirlpool.

pawn Код:
if (strcmp(cmd, "/register", true) ==0 )
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 1)
            {
                SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "{DC0C0C}Los Santos: {FFFFFF}Esti deja logat.");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            /*new namestring = strfind(sendername, "_", true);
            if(namestring == -1)
            {
                SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: Your name is not acceptable.");
                SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Hint: Your name must be in the format Firstname_Lastname.");
                Kick(playerid);
                return 1;
            }*/

            GetPlayerName(playerid, sendername, sizeof(sendername));
            //format(string, sizeof(string), "%s.ini", sendername);
            new sqlaccountexists = MySQLCheckAccount(sendername);
            //new File: hFile = fopen(string, io_read);
            if (sqlaccountexists != 0)
            {
                SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: There is already a citizen with that name.");
                //fclose(hFile);
                return 1;
            }
            new tmppass[64];
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: /register [password]");
                return 1;
            }
            strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
            new escpass[200],buf[129];
            mysql_real_escape_string(tmppass,escpass);
            WP_Hash(buf,129,escpass);
            OnPlayerRegister(playerid,escpass);
        }
        return 1;
    }
I used this code but it doesn't work. The password saved in the database is the password written by the user, it isn't crypted. Could you please help me fix it?
Reply
#2

Change
Код:
OnPlayerRegister(playerid,escpass);
to
Код:
OnPlayerRegister(playerid,buf);
because escpass is the real password and buf is the encrypted one.
Reply
#3

Oh, yes. Didn't see! Thanks a lot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)