我使用Crypt :: RC4加密密码。但它无法加密包含“0”或“#”的密码。在零的情况下,程序被终止,而在#的情况下,它无法加密。
我是Perl的新手,我需要这个用于我的自动化脚本。我在Windows 64位上运行脚本。
答案 0 :(得分:1)
<强> 脚本: 强>
use strict;
use warnings;
use Crypt::RC4;
my $passphrase = 'abcde#01234';
my $plaintext = 'text with #0';
my $encrypted = RC4($passphrase, $plaintext);
print "Encrypted: ", $encrypted, "\n";
print "Encrypted: ", unpack('H*', $encrypted), " (hex)\n\n";
my $decrypted = RC4($passphrase, $encrypted);
print "Decrypted: $decrypted\n";
<强> 输出: 强>
Encrypted: C0Þ%;1$Kíùt¬
Encrypted: 4330de253b31244bedf974ac (hex)
Decrypted: text with #0