#!/usr/pkg/bin/perl

#
#  $Id: gpwd,v 1.2 2001/07/09 20:26:39 straszht Exp $
#

srand (time ^ $$ ^ unpack "%L*", `ps -aux | gzip`);

$c1=chr((int(rand(25))) + (int(rand(2)) ? 65 : 97));
$c2=chr((int(rand(25))) + (int(rand(2)) ? 65 : 97));

$seed = "$c1$c2";

if ($ARGV[0] eq "-s" ) {
    $nul  = shift;
    $seed = shift;
}

if (@ARGV == 1 ) {
    $pass = $ARGV[0];
} else {
    $pass = <STDIN>;
}

chomp $pass;
printf("%s is %s\n",$pass,crypt($pass,$seed));
