Subject: | decrypt string padding |
When decrypting an encrypted string the string is padded with several spaces. I'm trying to use to decrypt a database password.
The code:
use Crypt::TripleDES;
$des = new Crypt::TripleDES;
$passphrase = "1234567890";
#--------------------------------------------------------------
$plaintext = "abcd";
$len = length($plaintext);
print "$len plaintext = $plaintext\n";
$cyphertext = $des->encrypt3 ( $plaintext, $passphrase );
print "cyphertext = $cyphertext\n";
$plaintext1 = $des->decrypt3 ( $cyphertext, $passphrase );
$len = length($plaintext1);
print "$len plaintext1 = $plaintext1 X\n\n";
The results:
4 plaintext = abcd
cyphertext = 'ål¬lÑj
8 plaintext1 = abcd X