Good for creating passwords for .htpasswd files or for any other *nix password file: sub mkpasswd{ my($plaintextpass)=@_; my($salt1, $salt, $encrypted); $salt1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./'; $salt = substr($salt1,rand(length($salt1)),1); $salt .= substr($salt1,rand(length($salt1)),1); $encrypted = crypt($plaintextpass, $salt); return $encrypted; }