in reply to Something aint right using Crypt::CBC here...

Take a look at the Crypt::CBC documentation carefully. Under the function finish, it says (emphasis mine)

The CBC algorithm must buffer data blocks inernally until they are even multiples of the encryption algorithm's blocksize (typically 8 bytes). After the last call to crypt() you should call finish(). This flushes the internal buffer and returns any leftover ciphertext.

To fix your problem, change your finish lines, respectively, to the following:

syswrite( ENCRYPTED, $cipher->finish ); syswrite( DECRYPTED, $cipher->finish );

Good luck! Thanks for your question. (Also, others will likely suggest other ways of doing your I/O --- consider using some of them.)

Replies are listed 'Best First'.
Re^2: Something aint right using Crypt::CBC here...
by Ace128 (Hermit) on Jun 21, 2005 at 15:20 UTC
    Oh, ok, this was all I needed apparently. However, gonna look into the above aswell... Dont want any nasty bugs. :)