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.)
In reply to Re: Something aint right using Crypt::CBC here...
by kaif
in thread Something aint right using Crypt::CBC here...
by Ace128
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |