How to generate password?
#1

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

Why are you trying this? Why not use whirlpool? :O
Reply
#3

I asked about generating password, not hashing.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)