You need to read up on pack and unpack The * is a useful widget and using it fixes your problem.
use Crypt::CBC; my $What = "Some text to be encrypted."; # my $Length = length ( $What ) * 2; my $Cipher = Crypt::CBC->new ( [ key => $DBITT::CryptString ] ); my $CipherText = $Cipher->encrypt ( $What ); my $ASCII = unpack ( "H*", $CipherText ); print "Encrypted result of $What is $ASCII.\n"; print " That was " . length ( $ASCII ) . " bytes long.\n"; my $PlainText = $Cipher->decrypt ( $CipherText ); print "And back into the real world we have '$PlainText'.\n"; $PlainText = $Cipher->decrypt ( pack ( "H*", $ASCII ) ); print "Try via ASCII string it's '$PlainText'.\n"; __DATA__ Encrypted result of Some text to be encrypted. is 52616e646f6d49569aee +93f3d204172c101f93dcae2a2a94dd1142acf98a0067bdf2f0edfcb06b3543f3cf8d0 +5decc33. That was 96 bytes long. And back into the real world we have 'Some text to be encrypted.'. Try via ASCII string it's 'Some text to be encrypted.'.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Length of Crypt::CBC result
by tachyon
in thread Length of Crypt::CBC result
by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |