#!/usr/bin/perl
 
sub generate_salt
{
 my @chars=('a'..'z','A'..'Z','0'..'9');
 my $salt;
 foreach (1..4)
 {
   $salt.=$chars[rand @chars];
 }
 
 return $salt;
}
 
my $salt = &generate_salt;
 
print crypt("$ARGV[0]", "$salt");
#print crypt("$ARGV[0]", "salt"); #static salt, dangerous!