Hashing password - 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: Hashing password (
/showthread.php?tid=367840)
Hashing password - Nicholas. - 11.08.2012
How do I print this function to see if it hashes properly?
pawn Код:
stock hashit(string[])
{
new rand = random(10,15);
new hashed = md5(md5(rand) . md5('%s'));
return hashed;
}
Re: Hashing password -
leonardo1434 - 11.08.2012
a little thing, your code should give a warning, "unused string".
Re: Hashing password -
kickerbat - 11.08.2012
Quote:
Originally Posted by leonardo1434
a little thing, your code should give a warning, "unused string".
|
You can't recall
printf("%d",hashed);
he wants it like this:
Код:
#include <a_samp>
#if defined FILTERSCRIPT
stock hashit(string[])
{
new rand = random(10,15);
new hashed = md5(md5(rand) . md5('%s'));
return hashed;
}
public OnFilterScriptInit()
{
print("\n--------------------------------------");
printf("%d",hashed);
print("--------------------------------------\n");
return 1;
}
#endif
Re: Hashing password -
kickerbat - 11.08.2012
i'm trying to get it to work, we're working together, basically i'm trying to get it to encrypt.
can you help me out a bit?
Re: Hashing password -
leonardo1434 - 11.08.2012
it won't print, genius. hashed it's a local variable. if you wish to print it, it should be called inside it, or in this way.
pawn Код:
stock hashit(string[])
{
new rand = random(10,15);
new hashed = md5(md5(rand) . md5('%s'));
return hashed,setproperty(.name = #this, .value = hashed);
}
// usage.
printf("%d", getproperty(.name = #this));
By the way, this function is fully wrong, it gonna give you alot of warnings.
~Cheers.
Re: Hashing password -
kickerbat - 11.08.2012
hey, if won't give me a return in the console:
Код:
stock hashit(string[])
{
new rand = random(10,15);
new hashed = md5(md5(rand) . md5('%s'));
return hashed,setproperty(.name = #this, .value = hashed);
}
public OnFilterScriptInit()
{
print("%d", getproperty(.name = #this));
return 1;
}
Re: Hashing password -
leonardo1434 - 11.08.2012
did you have at least copiled this function? it should display some warnings/erros on the pawno... by this logic, it won't printf anything since the property won't be set.
By the way, i won't fix your command, try figure out by yourself.
Re: Hashing password -
ReVo_ - 11.08.2012
O.o
Код:
stock hashit(string[])
{
new rand = random(10,15);
new hashed = md5(md5(rand) . md5('%s')); // <-- "." ? Is wrong.. is not PHP
return hashed;
}
printf("Result: %s", hashit("string here"));
Re: Hashing password -
kickerbat - 11.08.2012
Quote:
Originally Posted by leonardo1434
did you have at least copiled this function? it should display some warnings/erros on the pawno... by this logic, it won't printf anything since the property won't be set.
By the way, i won't fix your command, try figure out by yourself.
|
Compiled fine, no errors/warnings
Re: Hashing password -
kickerbat - 11.08.2012
Quote:
Originally Posted by leonardo1434
By the way, i won't fix your command, try figure out by yourself.
|
Don't post in Scritping "help" then.