Hello all,
I got the following code of another post:
Works well however I do not want my encrypted file decrypted to a file I want to capture is as a scalar. Tried the following but it did not work:
Also this command:
Undefines the default record separator I think. Do I need to redefine in my main program after the subroutines run?
Thanks,
Nick
If at first you don't succeed, don't try skydiving.
I got the following code of another post:
Code:
use strict;
use warnings;
use Crypt::CBC;
use FileHandle;
Encrypt();
Decrypt();
sub Encrypt {
open(CT,">ct.dat");
open(PT,"<pt.txt");
my $cipher = new Crypt::CBC({'key' => 't1234',
'cipher' => 'Blowfish',
'padding' => 'space'});
undef $/;
print CT $cipher->encrypt(<PT>);
close(CT);
close(PT);
}
sub Decrypt {
open(CT,"<ct.dat");
open(PT,">pt.dat");
my $cipher = new Crypt::CBC({'key' => 't1234',
'cipher' => 'Blowfish',
'padding' => 'space'});
undef $/;
print PT $cipher->decrypt(<CT>);
close(CT);
close(PT);
}
exit(0)
Works well however I do not want my encrypted file decrypted to a file I want to capture is as a scalar. Tried the following but it did not work:
Code:
my $passwd = PT $cipher->decrypt(<CT>);
Also this command:
Code:
undef $/;
Undefines the default record separator I think. Do I need to redefine in my main program after the subroutines run?
Thanks,
Nick
If at first you don't succeed, don't try skydiving.