This might be a 'gotcha' for some -- but the perl crypt function NORMALLY 
does DES-crypt. But if the salt is '$1$' it will use MD5 crypt. This is on 
newer Perl's (I don't think 5.005 behaves this way).


On Tue, 18 Feb 2003, Rowel Atienza wrote:
..
> #!/usr/bin/perl -w
> 
> system "stty -echo";
> print "Password: ";
> chomp(my $word = <STDIN>);
> system "stty echo";
> my $salt = '$1$';
> for(1..8) {
>       $salt = join('',$salt,chr(rand(127-33)+33));
> }
> print "\nMD5 Encrypted password:",crypt($word, $salt),"\n";

---
Orlando Andico <[EMAIL PROTECTED]>
Mosaic Communications, Inc.

_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Fully Searchable Archives With Friendly Web Interface at http://marc.free.net.ph

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to