Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Any inputs as to why this is happening would be great to have! Thanks, KM#!/usr/perl5/bin -w use Crypt::CBC; $inFile = "test.dat"; $cryptFile = "Crypt.dat"; $decrypFile = "DeCrypt.dat"; if ($#ARGV < 0) { print STDOUT "Invalid number of command line parameters! \n"; exit(1); } $mode = shift @ARGV; unless (($mode == 0) || ($mode == 1)) { print STDOUT "Invalid command line argument1 \n"; exit(2); } $cipher = Crypt::CBC->new( { 'key' => '18829298', 'cipher' => 'DES', 'iv' => '87654321', 'regenerate_key' => 0, 'prepend_iv' => 0 } ); if ($mode == 0) { open(INFILE, "<$inFile") || die "Error opening source file for inp +ut! \n"; open(CRYPTFILE, ">$cryptFile") || die "Error opening crypt file fo +r output! \n"; $cipher->start('encrypting'); while (<INFILE>) { print CRYPTFILE $cipher->crypt($_); } close INFILE; close CRYPTFILE; } else { open(CRYPTFILE, "<$cryptFile") || die "Error opening crypt file fo +r input! \n"; open(DECRYPFILE, ">$decrypFile") || die "Error opening decrypt fil +e for output! \n"; $cipher->start("decrypting"); while (<CRYPTFILE>) { print DECRYPFILE $cipher->crypt($_); } close CRYPTFILE; close DECRYPFILE; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Crypt::CBC help!
by BMaximus (Chaplain) on Mar 13, 2002 at 00:19 UTC | |
by Anonymous Monk on Mar 13, 2002 at 15:40 UTC | |
|
Re: Crypt::CBC help!
by Ryszard (Priest) on Mar 13, 2002 at 00:24 UTC | |
|
Re: Crypt::CBC help!
by webadept (Pilgrim) on Mar 13, 2002 at 02:51 UTC |