Boring has asked for the wisdom of the Perl Monks concerning the following question:
I have a problem on string compare:
use Crypt::CBC; use MIME::Base64; my $key = '0000000123456789009876543210abcdefghijklmnopqrstuvwxyz'; my $iv = '87654321'; my $cipt = 'hED7MTyAXjY='; #encrypted string "u_ser_a" my $cmp = "u_ser_a"; $cipher = Crypt::CBC->new( -key => $key, -cipher => 'Blowfish', -iv => $iv, -header => 'none', -padding => 'standard', -literal_key => 'true', -keysize => length($key), ); $clt = $cipher->decrypt(decode_base64($cipt)); if ($cmp eq $clt) { print "correct!\n"; } else { print "not match!n"; }
However, the result is "not match!".
I have no idea why the output is "not match".
Please advice.
Thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare string problem
by jethro (Monsignor) on Dec 10, 2010 at 09:42 UTC | |
by Boring (Novice) on Dec 10, 2010 at 09:57 UTC | |
|
Re: compare string problem
by moritz (Cardinal) on Dec 10, 2010 at 09:37 UTC | |
|
Re: compare string problem
by Anonymous Monk on Dec 10, 2010 at 09:35 UTC |