#!/usr/bin/perl # crypt.cgi by David Efflandt tech-ph@de-srv.com # last updated 2/3/00 # Crypts a password for use with web authentication # Modified to also work with older CGI.pm versions # that do not support tables (like v2.36) use CGI; $q = new CGI; srand( time() ^ ($$ + ($$ << 15))); print $q->header,$q->start_html('Crypt a Password'),"\n"; if ($q->param()) { $word = $q->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 "

Result of crypt $word


A crypted version of ", "$word is: $pass

", "Example of a line in a password file for web authentication ". "(colon separated):

username:$pass

"; } print qq(Note: This Script ), "works best when run on the system you need passords for because some ", "systems use a more secure crypt that ends up with more than the ", "usual 13 character crypted password."; print $q->start_form, "
), "
", "Crypt a Plain Text Password
", qq(
",$q->end_form,$q->end_html;