I am having a strange problem while using the Crypt::CBC module. First i wrote a simple test script that encodes and decodes using Crypt::CBC and 'Blowfish'. I encrypted a file and then decrypted the encrypted file. The resulting file was the same as the original file. I then wrote another version of my test script which attempted to decrypt a file and then use the "split" function to break the decrypted data into an array of lines. Although all the data was correctly decrypted, the split function only generated 1 line, not the correct number of lines. Here is the relevant code lines.
use strict; use warnings; use Crypt::CBC; my $cipher; $cipher = Crypt::CBC->new( -key => $secret_key, -cipher => 'Blowfish' ); local $/; unless ( open(INPUT,"<$filename") ) { die("open failed for file '$filename' : $!\n"); } # UNLESS $data = <INPUT>; close(INPUT); $decrypted = $cipher->decrypt($data); @lines = split(/\r\n/,$decrypted); $num_lines = split(/\r\n/,$decrypted);
When I ran the script, the data was correctly decrypted, however the split() function only generated one big line. Why did I not get the correct number of lines ? I am running on a windows 7 laptop using perl 5.16.3
In reply to problem with Crypt::CBC by bugbuster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |