in reply to Crypt::CBC help!

I don't see $cipher->finish anywhere. Read the Crypt::CBC man page. $cipher->finish must be called after the last $cipher->crypt() to flush the buffer out. That's why the last line isn't making it to the file.

Update:I think I need to elaborate.

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($_); } print CRYPTFILE $cipher->finish; close INFILE; close CRYPTFILE;


Replies are listed 'Best First'.
Re: Re: Crypt::CBC help!
by Anonymous Monk on Mar 13, 2002 at 15:40 UTC
    Duh! I really was clumsy there. Didn't read the documentation all the way through. Thanks for your input worked.