#! /local/bin/perl # Created by xwolf (Wolfgang Wiese, http://www.xwolf.com), July 2000 # if ((not $ARGV[0]) || (not $ARGV[1])) { print "Syntax: $0 (USERNAME) (PASSWORD)\n"; print "\tPrints out the new line as it should be added in the password-file using\n"; print "\tthe Apache mod_access - Modul\n"; exit; } if ($ARGV[0] =~ /[^a-zA-Z0-9]/) { print "Username contains invalid chars: $ARGV[0]\n"; exit; } my $pwd = Crypt_Password($ARGV[1]); print "$ARGV[0]:$pwd\n"; exit; ################################## sub Crypt_Password { my ($pwdplain) = $_[0]; my $salt = seedchar().seedchar();; my $result; $result = crypt($pwdplain,$salt); return $result; ########################## sub seedchar { # from Randal Schwarz ('a'..'z','A'..'Z','0'..'9','.','/')[rand(64)]; } }