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";



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

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to