SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 18/05/2018, 03:51 PM   #11
Kraeror
Huge Clucker
 
Kraeror's Avatar
 
Join Date: Mar 2017
Location: Bulgaria
Posts: 426
Reputation: 19
Default Re: MySQL password hash

Quote:
Originally Posted by kovac View Post
I don't think he meant it that way.

You can't and don't need to dehash it, only compare

PHP Code:
        case DIALOG_LOGIN:
        {
            if(
response)
            {
                new 
query[500], HashedPW[130];
                
WP_Hash(HashedPWsizeof(HashedPW), inputtext);
                
mysql_format(Databasequerysizeof(query), "SELECT * FROM userdata WHERE User='%e' AND Password='%e'"GetName(playerid), HashedPW);
                
mysql_tquery(Databasequery"OnUserLogin""d"playerid);
            }
              else
                
Kick(playerid);
            return 
1;
        }
        case 
DIALOG_REGISTER:
        {
            if(
response)
             {
                new 
query[500], HashedPW[130], GPCI[128];
                
gpci(playeridGPCIsizeof(GPCI));
                
WP_Hash(HashedPWsizeof(HashedPW), inputtext);
                
mysql_format(Databasequerysizeof(query), "INSERT INTO `userdata` (`User`,`Password`,`RegisterIP`, `CreatedOn`, `GPCI`) VALUES ('%e', '%e', '%e', NOW(), '%e')"GetName(playerid), HashedPWPlayer_IP[playerid], GPCI);
                
mysql_tquery(Databasequery"OnUserRegister""d"playerid);
            }
            else
                 
Kick(playerid);
            return 
1;
        } 
Thanks a lot I will try +REP!!!
Kraeror is offline   Reply With Quote
Old 18/05/2018, 04:25 PM   #12
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,670
Reputation: 3061
Default Re: MySQL password hash

Use BCrypt. Nothing else.
Y_Less is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Hash Problem & MYSQL Saving Problem Faqahat Scripting Help 3 18/04/2016 11:54 AM
Password hash Nahin Scripting Help 9 12/04/2014 11:32 AM
MySQL Password Hash DarkKillerWithPride<3 Scripting Help 3 04/01/2012 06:03 PM
Hash MySQL-Password DeathOnaStick Help Archive 4 25/08/2010 04:18 PM


All times are GMT. The time now is 08:05 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.