Hi All,
 
 I'm trying to encrypt/decrypt a text file using Crypt::CBC with DES.
 
 The encryption works fine but the decryption seems to yield 
 only the first
 few bytes of the original text.  I'm sure i'm missing 
 something simple.
 
 Any help appreciated.
 
 Example follows:
 
 <enc.pl>
 use strict;
 use Crypt::CBC;
 
 my $key = pack "H16", "1122334455667788";
 my $cipher = new Crypt::CBC ($key, 'IDEA');
 
 my $in;
 open(IN,'e:\some_largish_text_file') || die $!;
 print $cipher->encrypt($in) while read(IN,$in,1024);
 print $cipher->finish;
 close(IN);
 </enc.pl>
 
 
 
 <dec.pl>
 use strict;
 use Crypt::CBC;
 
 if (!@ARGV) { die "Usage: perl $0 encrypted_file > 
 decrypted_output_file"; }
 
 my $key = pack "H16", "1122334455667788";
 my $cipher = new Crypt::CBC ($key, 'IDEA');
 
 my $in;
 open(IN,$ARGV[0]) || die $!;
 print $cipher->decrypt($in) while read(IN,$in,1024);
 print $cipher->finish;
 close(IN);
 </dec.pl>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to