WP_Hash to SHA-256 hashing
#1

I have that part of script and I want to change wp_hash with sha-256 hashing method :
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case LoginDialog:
        {
            if(!response) Kick(playerid);

            new
                hashpass[129],
                query[100],
                playername[MAX_PLAYER_NAME];

            GetPlayerName(playerid, playername, sizeof(playername));
            WP_Hash(hashpass, sizeof(hashpass), inputtext);
            if(!strcmp(hashpass, Player[playerid][Password]))
            {
                mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", playername);
                mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
            }
            else
            {
                SendClientMessage(playerid, -1, "You have specified an incorrect password!");
                ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Login", "Welcome player!\nYour account has been found in our database. Please fill in your password:", "Login", "Quit");
            }
        }
        case RegisterDialog:
        {
            if(!response) return Kick(playerid);
            if(strlen(inputtext) < 5)
            {
                SendClientMessage(playerid, -1, "Your password must at least contain more than 4 characters.");
                return ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Register", "Welcome player!\nYour account has not been registered yet. Please fill in your desired password:", "Register", "Quit");
            }
            new
                query[512],
                playername[MAX_PLAYER_NAME],
                playerip[16];


            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerIp(playerid, playerip, sizeof(playerip));
            WP_Hash(Player[playerid][Password], 129, inputtext);
            mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%e', '%e', '%e', 0, 0, 0, 0.0, 0.0, 0.0, 0.0)", playername, Player[playerid][Password], playerip);
            mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
        }
    }
	return 1;
}
Reply
#2

Why? Whirlpool is a stronger algorithm.
Reply
#3

I want to change it because I always taking this message when I start server !!
Quote:

Error: Function not registered: 'WP_Hash'

I have this in script :
Quote:

native WP_Hash(buffer[], len, const str[]);

I have plugin .. I dont know where is problem .. It made me very angry
Reply
#4

you add
Код:
native WP_Hash(buffer[], len, const str[]);
on top script?
Reply
#5

Yeahh
Reply
#6

That means that the plugin isn't loaded. Check your server_log.txt and double check your server.cfg "plugins" line.
Whirlpool is deemed more secure than SHA-256, but any salt is better than no salt at all. You may want to look into the bcrypt plugin as well.
Reply
#7

Quote:

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[20:31:37] filterscripts = "" (string)
[20:31:37]
[20:31:37] Server Plugins
[20:31:37] --------------
[20:31:37] Loading plugin: mysql
[20:31:37] >> plugin.mysql: R39-3 successfully loaded.
[20:31:37] Loaded.
[20:31:37] Loading plugin: nativechecker
[20:31:37] Loaded.
[20:31:37] Loading plugin: Whirlpool
[20:31:37]
[20:31:37] ==================
[20:31:37]
[20:31:37] Whirlpool loaded
[20:31:37]
[20:31:37] ==================
[20:31:37]
[20:31:37] Loaded.
[20:31:37] Loading plugin: sscanf
[20:31:37]

[20:31:37] ===============================

[20:31:37] sscanf plugin loaded.

[20:31:37] Version: 2.8.1

[20:31:37] © 2012 Alex "******" Cole

[20:31:37] ===============================

[20:31:37] Loaded.
[20:31:37] Loaded 4 plugins.

[20:31:37]
[20:31:37] Filterscripts
[20:31:37] ---------------
[20:31:37] Loaded 0 filterscripts.

[20:31:37] Error: Function not registered: 'WP_Hash'
[20:31:37] [MySQL] The connection was successful.
[20:31:37]
----------------------------------
[20:31:37] Necron
[20:31:37] ----------------------------------

[20:31:37] Number of vehicle models: 0

I think plugin is loaded
Reply
#8

It seems so. Really, really strange. It's working fine for me. Try re-downloading the plugin.
Also make sure you have this definition on top of your mode, and make sure that you recompile.
Код:
native WP_Hash(buffer[], len, const str[]);
Reply
#9

These are SA-MP gamemodes, not banks. Stating that "Whirlpool is a more secure hash" may not necessarily be incorrect, however, for the data that is stored by a SA-MP server, a salted SHA-256 encryption is more than enough.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)