[Gllug] passwd and creating passwords

Jason Clifford jason at ukpost.com
Tue Jan 27 19:29:30 UTC 2004


On Tue, 27 Jan 2004, Pete Ryland wrote:

> > The following perl will do it for you:
> > 
> > my $salt = '$1$';
> > $salt .= join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64, 
> >          rand 64, rand 64, rand 64, rand 64, rand 64, rand 64];
> > my $pwcrypt = crypt($password, $salt);
> > 
> > They key thing to note is that the salt is $1$ followed by 8 more slat 
> > characters.
> 
> Shouldn't the salt be random?

It is - rand() is the perl function for returning a random value. In this 
case it specifies a table of 64 characters including a-z, 0-9, . and / and 
then uses rand() 8 times to return a random character from the range.

It works very well for me.

Jason Clifford
-- 
UKFSN.ORG		Finance Free Software while you surf the 'net
http://www.ukfsn.org/	   ADSL Broadband from just £23.75 / month 

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list