upload http
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / support / SHA1 / htpasswd-sha1.pl
1 #!/usr/bin/perl -w
2 use strict;
3 #
4 # Utility which takes a username and password
5 # on the command line and generates a username
6 # sha1-encrytped password on the stdout.
7
8 # Typical useage:
9 #       ./htpasswd-sha1.pl dirkx MySecret >> sha1-passwd
10 #
11 # This is public domain code.  Do whatever you want with it.
12 # It was originally included in Clinton Wong's Apache 1.3.6 SHA1/ldif
13 # patch distribution as sample code for generating entries for
14 # Apache password files using SHA1.
15
16 use MIME::Base64;  # http://www.cpan.org/modules/by-module/MIME/
17 use Digest::SHA1;  # http://www.cpan.org/modules/by-module/MD5/
18
19 if ($#ARGV!=1) { die "Usage $0: user password\n" }
20
21 print $ARGV[0], ':{SHA}', encode_base64( Digest::SHA1::sha1($ARGV[1]) );
22