SA-MP Forums Archive
WP_Hash to SHA-256 hashing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: WP_Hash to SHA-256 hashing (/showthread.php?tid=581448)



WP_Hash to SHA-256 hashing - Cyber123 - 13.07.2015

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;
}



Re: WP_Hash to SHA-256 hashing - Sithis - 13.07.2015

Why? Whirlpool is a stronger algorithm.


Re: WP_Hash to SHA-256 hashing - Cyber123 - 14.07.2015

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


Re: WP_Hash to SHA-256 hashing - kloning1 - 14.07.2015

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


Re: WP_Hash to SHA-256 hashing - Cyber123 - 14.07.2015

Yeahh


Re: WP_Hash to SHA-256 hashing - Virtual1ty - 14.07.2015

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.


Re: WP_Hash to SHA-256 hashing - Cyber123 - 14.07.2015

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


Re: WP_Hash to SHA-256 hashing - Virtual1ty - 14.07.2015

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[]);



Re: WP_Hash to SHA-256 hashing - Jay_ - 14.07.2015

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.