How to generate password? -
Luka P. - 20.02.2012
Hello, another problem.
This doesn't work.
pawn Code:
stock GeneratePassword()
{
new password[9];
new charset[2][26] =
{
{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'},
{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'G', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}
};
for(new i=0; i < sizeof(string); i++)
{
strcat(password, charset[random(sizeof(charset))][random(25)]);
}
return string;
}
Re: How to generate password? -
thimo - 20.02.2012
Why are you trying this? Why not use whirlpool? :O
Re: How to generate password? -
Luka P. - 20.02.2012
I asked about
generating password, not hashing.
Re: How to generate password? -
Luka P. - 20.02.2012
Thanks. This works now.
pawn Code:
stock GeneratePassword()
{
new password[9];
new charset[2][26] =
{
{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'},
{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'G', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}
};
for(new i=0; i < sizeof(password) - 1; i++)
{
password[i] = charset[random(sizeof(charset))][random(25)];
}
password[8] = '\0';
return password;
}