SA-MP Forums Archive
Hhash_hmah problem - 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: Hhash_hmah problem (/showthread.php?tid=470149)



Hhash_hmah problem - Jajetin - 16.10.2013

Hello;
Have a problem with hhash_hmah
PHP код:
C:\Users\Casa\Desktop\JustRP.pwn(391) : error 035argument type mismatch (argument 4)
C:\Users\Casa\Desktop\JustRP.pwn(449) : error 035argument type mismatch (argument 4)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
2 Errors

..

PHP код:
native hhash_hmac(algidinput[], key[], buffer[], buflen); 
.. 391
PHP код:
   case DIALOG_LOGIN:
        {
            new 
HashedPassword[129];
            
hhash_hmac(H_SHA256inputtextHashedPasswordH_SHA256_LEN); 
..449
PHP код:
       hhash_hmac(H_SHA256inputtextPlayerInfo[playerid][pPass], H_SHA256_LEN); 

and .. and above I have defined

PHP код:
#define H_MD5            1
#define H_SHA1            2
#define H_SHA256        3
#define H_SHA512        4
#define H_RIPEMD160        5
#define H_WHIRLPOOL        6
#define H_MD5_LEN    32
#define H_SHA1_LEN    40
#define H_SHA256_LEN    64
#define H_SHA512_LEN    128
#define H_RIPEMD160_LEN    40
#define H_WHIRLPOOL_LEN    128 



Re: Hhash_hmah problem - Misiur - 16.10.2013

You are passing 4 arguments instead of 5. Are you sure you need hhash_hmac, not simply hhash? If you do, you have to provide key


Re: Hhash_hmah problem - Jajetin - 16.10.2013

Yes, i need "hhash_hmac" because my PHP system is in "hhash_hmac".
can you explain more about "you have to Provide key"?


Greetings.


Re: Hhash_hmah problem - Misiur - 16.10.2013

pawn Код:
hhash_hmac(H_SHA256, inputtext, MISSINGKEY, PlayerInfo[playerid][pPass], H_SHA256_LEN);
PHP requires key as well (http://php.net/manual/en/function.hash-hmac.php third argument). You have to port it to your gamemode


Re: Hhash_hmah problem - Jajetin - 16.10.2013

Hello,

In this case:

In php i have: 4!$aw - unique key
PHP код:
define('DB_PASS_SALT''4!$aw'); 
in pawno, how can be put?

PHP код:
 hhash_hmac(H_SHA256inputtext4!$awPlayerInfo[playerid][pPass], H_SHA256_LEN); 
or how?

thanks


Re: Hhash_hmah problem - Misiur - 16.10.2013

Somewhere near the top of gamemode:

pawn Код:
static const hash_key[] = "4!$aw";
Then later
pawn Код:
hhash_hmac(H_SHA256, inputtext, hash_key, PlayerInfo[playerid][pPass], H_SHA256_LEN);
You might want to consider some additional security stuff, because db connection data and that salt will be visible in plaintext in amx.


Re: Hhash_hmah problem - Jajetin - 16.10.2013

Yeah,
works perfectly, thanks for everything.

Fixed.