passwort create with perl

Matthew Seaman m.seaman at infracaninophile.co.uk
Fri Sep 12 09:11:34 PDT 2003


On Fri, Sep 12, 2003 at 02:22:11PM +0200, thomas may wrote:

> iam searching for a perl programm to create an freebsd user account
> password, i dont want to change a password, i want to see it on the
> command line, to copy and paste it into another application.

You want to input the password to the perl program and get from it the
password hash as stored in /etc/master.passwd?  This will generate you
the MD5 hash:

   #!/usr/bin/perl -w

   @pwchars = ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '/', '.');

   $salt = '$1$';
   for (1 .. 8) {
     $salt .= $pwchars[rand @pwchars];
   }
   $salt .= '$';

   print crypt($ARGV[0], $salt), "\n";

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030912/f9432233/attachment.bin


More information about the freebsd-questions mailing list