Skip to content

Instantly share code, notes, and snippets.

@Fleshgrinder
Created August 14, 2012 14:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Fleshgrinder/3349662 to your computer and use it in GitHub Desktop.
Save Fleshgrinder/3349662 to your computer and use it in GitHub Desktop.
Generate htpasswd compatible password.
#!/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 $!;
}
@ggl
Copy link

ggl commented Feb 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment