Problems with the Whirlpool Plugin
#1

Hello,

This may seem like a noob'ish question to many of you but I thought I better ask now.

I have tried to create a simple Register System with the Whirlpool Plugin and dialogues. To make a register dialogue and store the password in hashed form into it by using dini was no problem but I really can't get the login dialogue working. How to check the inputtext - password?

Код:
if(dini_Get(pfile,"Password") == WP_Hash(buf,sizeof(buf),inputtext))
^ This code seems to fail hard. So please tell me how to check the password by using the whirlpool plugin.
Reply
#2

You can't use '==' to compare strings, use strcmp instead:
pawn Код:
new string[129];

WP_Hash(string, sizeof(string), inputtext);
if(strcmp(string, dini_Get(pfile, "Password"), false) == 0)
{
    // Password matched.
}
else
{
    // Password didn't match.
}
You have to hash the inputtext (the text that the player typed) and compare it to the HASHED password you will get from the INI file. You have to remember hashing the password before saving them.

If you need help with strcmp: https://sampwiki.blast.hk/wiki/Strcmp

I used dini_Get as I believe (not sure though) it returns the password, so it's valid to use it as a string in strcmp.
Reply
#3

Ah thanks a lot. Everything is working fine now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)