On Thu, 06 Jul 2000, Paul Lussier <[EMAIL PROTECTED]> wrote:
>
> Actually, I am using the Crypt-PasswdMD5-1.0 module which is dependant upon
> the Digest::MD5 module. I'm just not sure how I'd go about creating a
> password. Would this suffice:
>
> #!/usr/bin/perl
>
> my ($password) = shift;
> my (@salt) = ('a..z','A..Z','0..9','.','/'); # Legal salt characters
This doesn't look right^^^^ ^^^^ ^^^^
The single quotes should be absent otherwise it is a literal string 'a..z'...
> # need a 12 character salt (according to Niall :)
>
> $salt = int(rand(@salt)) . int(rand(@salt)) . int(rand(@salt)) .
> int(rand(@salt)) . int(rand(@salt)) . int(rand(@salt)) .
> int(rand(@salt)) . int(rand(@salt)) . int(rand(@salt)) .
> int(rand(@salt)) . int(rand(@salt)) . int(rand(@salt)) ;
Since @salt has 5 elements this glues together 12 numbers between 0-4
together. Is that what you want?
I think you'll want something like $salt[int(rand(@salt))] somehow...
If you don't mind DES, this will work (no warrantee):
#!/usr/bin/perl
@salt = (a..z, A..Z, '.', '/');
$salt = $salt[int(rand(@salt))];
$salt .= $salt[int(rand(@salt))];
$pass = shift;
print $salt, crypt($pass, $salt), "\n";
# first 2 chars of Unix passwd are the salt, so print it out.
**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************