sparkyichi has asked for the wisdom of the Perl Monks concerning the following question:
#!c:/perl/bin/perl -w use Crypt::TripleDES; use strict; my $des = new Crypt::TripleDES; my $passcode; my $inst = $ARGV[0]; my $inputfile = $ARGV[1]; my $outputfile = $ARGV[2]; my $i = @ARGV; &Get_Input; &Cypher_Run; sub Get_Input{ print "Get pass code > "; $passcode = <STDIN>; } sub Cypher_Run{ my @file; open(INPUT, "<$inputfile") || die "Could not open input file:$!\n" +; open(OUTPUT, ">$outputfile") || die "Could not open output file:$! +\n"; while (<INPUT>){chomp($_); push (@file, $_)}; if ($inst eq 'e'){ foreach (@file){ my $cyphertext = $des->encrypt3 ( $_, $passcode ); print OUTPUT "$cyphertext\n"; } } elsif ($inst eq 'd'){ foreach (@file){ my $plaintext = $des->decrypt3 ( $_, $passcode ); print OUTPUT "$plaintext\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(ichimunki) Re: Crypt::TripleDES decrypting problem
by ichimunki (Priest) on Jan 10, 2002 at 04:38 UTC | |
by sparkyichi (Deacon) on Jan 10, 2002 at 20:37 UTC | |
by ichimunki (Priest) on Jan 10, 2002 at 21:19 UTC | |
by sparkyichi (Deacon) on Jan 10, 2002 at 21:40 UTC | |
|
Re: Crypt::TripleDES decrypting problem
by khkramer (Scribe) on Jan 11, 2002 at 00:33 UTC |