public
Last active

Generate htpasswd compatible password.

  • Download Gist
crypt.pl
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl
use strict;
 
chomp(my $filename=$ARGV[0]);
chomp(my $username=$ARGV[1]);
chomp(my $password=$ARGV[2]);
 
if (!$filename || !$username || !$password) {
print "USAGE: ./crypt.pl filename username password\n\n";
} else {
open FILE, ">>", $filename or die $!;
print FILE $username . ":" . crypt($password, $username) . "\n";
close FILE or die $!;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.