0

我正在使用 Crypt::RC4 来加密密码。但它无法加密包含“0”或“#”的密码。在零的情况下,程序被终止,而在 # 的情况下,它无法加密。

我是 Perl 新手,我的自动化脚本需要这个。我在 Windows 64 位上运行脚本。

4

1 回答 1

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
于 2012-04-13T20:08:33.663 回答