talexb has asked for the wisdom of the Perl Monks concerning the following question:
In other words, is the length of the encrypted data the same as the original data? It seems that it should be. My test code is as follows:
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$Length", $CipherText ); print "Encrypted result of $What is $ASCII."; 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$Length", $ASCII ) ); print "Try via ASCII string it's '$PlainText'.\n";
and when I run it I get
The two values of $PlainText don't match. Assistance would be greatly appreciated.Encrypted result of Some text to be encrypted. is 52616e646f6d49568bd87928f7ccbbbef6b6fcd504407b611fd9. That was 52 bytes long. And back into the real world we have 'Some text to be encrypted.'. Try via ASCII string it's ''.
--t. alex
"Here's the chocolates, and here's the flowers. Now how 'bout it, widder hen, will ya marry me?" --Foghorn Leghorn
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Length of Crypt::CBC result
by tachyon (Chancellor) on Apr 04, 2002 at 01:58 UTC | |
by talexb (Chancellor) on Apr 04, 2002 at 03:06 UTC | |
|
Re: Length of Crypt::CBC result
by rjray (Chaplain) on Apr 04, 2002 at 01:42 UTC | |
|
Re: Length of Crypt::CBC result
by cacharbe (Curate) on Apr 04, 2002 at 02:01 UTC | |
|
Re: Length of Crypt::CBC result
by Ryszard (Priest) on Apr 04, 2002 at 11:45 UTC | |
by talexb (Chancellor) on Apr 04, 2002 at 14:48 UTC | |
by Anonymous Monk on Apr 04, 2002 at 17:29 UTC | |
by Ryszard (Priest) on Apr 04, 2002 at 21:18 UTC | |
|
Re: Length of Crypt::CBC result
by Anonymous Monk on Apr 04, 2002 at 17:21 UTC | |
|
Re: Length of Crypt::CBC result
by no_slogan (Deacon) on Apr 04, 2002 at 19:37 UTC |