The first two letters of the encrypted string are the salt. eg:
my $password = "abc"; my $salt = "GH"; my $encrypted = crypt($password, $salt); print "$encrypted\n"; print substr($encrypted, 0, 2), "\n"; -------------------- will give you GHl/YThw3THFc GH On Sun, 2002-12-08 at 21:33, Jerry M.Howell II wrote: > hello there, > > Got another question. as far as I know I need the following to encrypt > a passwd in perl. I plan to use it to add a users to my /etc/passwd /etc/shadow > and /etc/group now I got a question cuz most newbees do :) what am I missing > in this script I've narowed it down to the crypt command and found out in the > cammel book it should be crypt(plaintext,salt) if I understood it corectly. > what do I need for the salt???? > my script is the following (don't laugh to hard :)) > > #!/usr/bin/perl > print "Enter your preferd username.\n"; > $username = <STDIN>; > chomp($username); > print "enter your prefered password\n"; > $passwd = <STDIN>; > $passwd=crypt($passwd); > chomp($passwd); > print `/usr/sbin/useradd "$username" -p "$passwd"`; > > -- > Jerry M. Howell II -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]