2012-04-10 155 views
1

我使用Crypt :: RC4加密密碼,但它不能加密包含'0'或'#'的密碼。如果零程序被終止,而在#它無法加密的情況。我是perl的新手,能否請你幫忙,因爲我急需我的自動化腳本。我可以在Windows 64位上運行腳本。有人請幫忙。使用Crypt :: RC4加密密碼問題

+2

,你能否告訴我們您所使用的代碼,它顯示的代碼,你可以寫最小的位這個問題? – Konerak 2012-04-10 08:51:37

回答

1

腳本:

use strict; 
use warnings; 
use Crypt::RC4; 

my $passphrase = 'abcde#'; 
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