Hhash_hmah problem
#1

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 
Reply
#2

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
Reply
#3

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


Greetings.
Reply
#4

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
Reply
#5

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
Reply
#6

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.
Reply
#7

Yeah,
works perfectly, thanks for everything.

Fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)