Hashing password
#1

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

pawn Код:
printf("%d",hashed);
a little thing, your code should give a warning, "unused string".
Reply
#3

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
pawn Код:
printf("%d",hashed);
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
Reply
#4

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

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

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;
}
Reply
#7

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

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"));
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)