see corrections below > -----Original Message----- > From: Toby Stuart [mailto:toby.stuart@;figtreesys.com.au] > Sent: Wednesday, October 23, 2002 3:35 PM > To: '[EMAIL PROTECTED]' > Subject: Crypt::CBC w/Crypt-DES > > > 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 $cipher = new Crypt::CBC ($key, 'DES'); > > 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 $cipher = new Crypt::CBC ($key, 'DES'); > > my $in; > open(IN,$ARGV[0]) || die $!; > print $cipher->decrypt($in) while read(IN,$in,1024); > print $cipher->finish; > close(IN); > </dec.pl> > > _______________________________________________ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs