[Help] Password Hash
#1

Hello, I am using the plugin Teprey: Hash / HMAC plugin (0.2) (Use the encryption method SHA-256), what happens is that I have a problem, as I checked in my gamemode, password hashea perfectly, but when I try logging, seems not read it and I get wrong password, someone could say that I have wrong? from already thank you very much and greetings to all.


Код:
case DIALOG_LOGIN:
        {
            if(!response)
            {
                return SendClientMessageEx(playerid, COLOR_JUST, "SERVER: Usted ha sido expulsado automбticamente del servidor. Razуn: Cancelar el registro/login de su personaje."),
                Expulsar(playerid);
            }
            else
            {
                mysql_real_escape_string(PlayerInfo[playerid][pPass],PlayerInfo[playerid][pPass],ConexionMySQL);
                hhash(H_SHA256,  inputtext, inputtext, 129);
                if(strcmp(PlayerInfo[playerid][pPass], inputtext, true, 128) == 0)
                {
                    new string[128];
                    LimpiarPantalla(playerid);
                    StopAudioStreamForPlayer(playerid);
                    format(string, sizeof(string), "SERVER: "COLOR_BLANCO_HEX"Bienvenido(a) a %s (Versiуn: %s), %s", SERVER_NOMBRE, SERVER_GM_VERSION, ReturnNameEx(playerid));
                    SendClientMessageEx(playerid, COLOR_JUST, string);
                    format(Query, sizeof(Query), "SELECT * FROM `usuarios` WHERE `Nombre` = '%s'", ReturnName(playerid));
                    mysql_function_query(ConexionMySQL, Query, true, "OnQueryFinish", "ii", THREAD_CARGAR_CUENTA, playerid);
                }
                else
                {
                    Login_Intentos[playerid]++;
                    if(Login_Intentos[playerid] == MAX_INTENTOS_LOGIN)
                    {
                        return Expulsar(playerid);
                    }
                    new cam = Random(1,8);
                    SetPlayerJoinCamera(playerid, cam);
                    SendClientMessageEx(playerid, -1, "SERVER: Contraseсa Incorrecta!"),
                    format(szDialog, sizeof(szDialog), "Bienvenido(a) %s!\nIngresa tu contraseсa para ingresar al servidor.\n\nContraseсa:", ReturnNameEx(playerid));
                    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD ,"NS:RP - Ingreso",szDialog,"Entrar","Salir");
                }
            }
        }
        case DIALOG_REGISTRO:
        {
            if(!response)
            {
                return SendClientMessageEx(playerid, -1, "SERVER: Usted ha sido expulsado automбticamente del servidor. Razуn: Cancelar el registro de su personaje."),
                Expulsar(playerid);
            }
            if(strlen(inputtext) >= MAX_LONGITUD_PASS)
            {
                new cam = Random(1,8);
                SetPlayerJoinCamera(playerid, cam);
                return format(szDialog, sizeof(szDialog), "Bienvenido(a) %s!\nLa Contraseсa no debe ser mayor de 40 carбcteres.\n\nContraseсa:", ReturnNameEx(playerid)),
                ShowPlayerDialog(playerid,DIALOG_REGISTRO,DIALOG_STYLE_INPUT ,"NS:RP - Registro",szDialog,"Registrar","Salir");
            }
            if(response)
            {
                if(!strlen(inputtext))
                {
                    new cam = Random(1,8);
                    SetPlayerJoinCamera(playerid, cam);
                    format(szDialog, sizeof(szDialog), "La contraseсa que has introducido para el personaje %s es invбlida.\n\nIntйntalo de nuevo, coloca una contraseсa correcta por favor:", ReturnNameEx(playerid));
                    ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "NS:RP - Registro",szDialog,"Enviar","Salir");
                }
                mysql_real_escape_string(PlayerInfo[playerid][pPass], PlayerInfo[playerid][pPass], ConexionMySQL);
                hhash(H_SHA256,  inputtext, PlayerInfo[playerid][pPass], 129);
                PlayerInfo[playerid][pRegistrado] = 1;
                format(Query, sizeof(Query), "INSERT INTO `usuarios` (Nombre, Password, Registrado) VALUES ('%s', '%s', '%d')",
                ReturnName(playerid),
                PlayerInfo[playerid][pPass],
                PlayerInfo[playerid][pRegistrado]
                );
                mysql_function_query(ConexionMySQL, Query, true, "OnQueryFinish", "ii", THREAD_SIN_RESULTADO, playerid);
                format(szDialog, sizeof(szDialog), "Acabas de registrar el personaje %s en nuestra base de datos.\n\nAhora inicia sesiуn con la contraseсa introducida anteriormente:", ReturnNameEx(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,SERVER_NOMBRE" - Iniciar sesiуn",szDialog,"Enviar","Salir");
             }
        }
Reply
#2

Is this wrong? Your output is inputtext.
Код:
hhash(H_SHA256,  inputtext, inputtext, 129);
You could try this:

Код:
new hashed[H_SHA256_LEN];//you have constant for output size?
hhash(H_SHA256,inputtext,hashed,H_SHA256_LEN);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)