大家好,我正在制作一个 perl 脚本来加密和解密文本,我刚开始我有这个:
#!/usr/bin/perl
use Crypt::IDEA;
my $key = pack("H32", "0123456789ABCDEF0123456789ABCDEF");
my $cipher = new IDEA $key;
my $palabra= "plaintex";
my $ciphertext = $cipher->encrypt($palabra); # NB - 8 bytes
print unpack("H16", $ciphertext), "\n";
my $plaintext = $cipher->decrypt($ciphertext);
print $plaintext , "\n";
问题是要加密的文本必须是 8 个字节的长度。为什么?如果我用“plaintext”代替“plaintex”会给我错误。
input must be 8 bytes long at /usr/lib/perl5/site_perl/Crypt/IDEA.pm line 62.