#!/usr/local/bin/perl # Small perl program to assist is encrypting passwords # Paul Gregg , March 1999. # http://www.pgregg.com/projects/ if (@ARGV) { $pw1 = shift; $seed = shift; } else { system("stty -echo"); print "Enter a Password: "; $pw1 = ; print "\nAgain: "; $pw2 = ; system("stty echo"); if ($pw1 ne $pw2) { print "Sorry, passwords don't match.\n"; exit; } print "\nSeed: "; $seed = substr(,0,2); } chomp($seed); chomp($pw1); if (length($seed) eq 0) { srand(time()); $a = int(rand(25) + 0.5) + (int(rand(1) + 0.5) * 32) + 65; $b = int(rand(25) + 0.5) + (int(rand(1) + 0.5) * 32) + 65; $seed = sprintf ("%c%c", $a, $b); } printf("Encrypted password: %s\n", crypt($pw1, $seed));