You really want to use pack/unpack to hex-format your ciphertext, so that they are guaranteed to be alphanumeric.
To wit:
use Crypt::CBC;
$cipher = Crypt::CBC->new( {
key => 'SomeSecretKeyHere',
cipher => 'Rijndael',
});
my $source_text = "This data is hush hush";
my $cipher_text = unpack('H*', $cipher->encrypt($source_text));
my $decrypted = $cipher->decrypt(pack('H*', $cipher_text));
Also, please do not use the fragile DES cipher, as weak crypto is worse than no crypto. Rijndael is much more secure, almost as fast, and equally easy to use.
Thanks,
/Autrijus/
| [reply] [d/l] |