#!/usr/local/bin/perl # crypt.cgi by David Efflandt tech-ph@de-srv.com # last updated 9/04/99 # Crypts a password for use with web authentication use CGI qw/:standard :netscape/; srand( time() ^ ($$ + ($$ << 15))); print header,start_html('Crypt a Password'),"\n", # '', "\n"; if (param()) { $word = param('word'); @range = ('0'..'9','a'..'z','A'..'Z','.','/'); $salt = $range[rand(int($#range)+1)] . $range[rand(int($#range)+1)]; $pass = crypt($word, $salt); print h1("Result of crypt $word"),hr,'A crypted version of ', em($word),' is: ',em($pass),p, 'Example of a line in a password file for web authentication '. '(colon separated):',p,pre("username:$pass"),hr; } print b("Note: "),a({href=>'crypt.txt'},'This Script'), ' works best when run on the system you need passords for because some systems use a more secure ',em('crypt'),' that ends up with more than the usual 13 character crypted password.'; print start_form,center(table({border=>1,cellpadding=>10},Tr([ th([("Crypt a Plain Text Password").br.textfield('word').br.submit]) ]))),end_form,p, end_html;