docofchaos has asked for the wisdom of the Perl Monks concerning the following question:
I wrote this but this is not the same resultfunction encrypt_text($plain_text, $key){ bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $plain_text, MCRYPT_ +MODE_ECB)); return $encrypt_text; }
have you got any idea ?use Crypt::Rijndael; use Crypt::CBC; sub chiffrer_string($plain_text, $key){ $key =~ pack('H*', $key); my $cipher = Crypt::CBC->new( -key => $key, -algorithm => 'RIJNDAEL_256', -mode => 'MODE_ECB', -padding => 'null', ) || die "Couldn't create CBC object"; my $cipher_text = $cipher->encrypt($plain_text); my $cipher_block = unpack ("H*", $cipher_text); return $cipher_block;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: same encrypt word ?
by Loops (Curate) on Oct 30, 2014 at 14:29 UTC | |
by docofchaos (Novice) on Oct 30, 2014 at 15:24 UTC | |
|
Re: same encrypt word ?
by perlron (Pilgrim) on Oct 30, 2014 at 11:24 UTC | |
by marto (Cardinal) on Oct 30, 2014 at 11:30 UTC | |
by perlron (Pilgrim) on Oct 30, 2014 at 11:34 UTC | |
by docofchaos (Novice) on Oct 30, 2014 at 11:32 UTC | |
by perlron (Pilgrim) on Oct 30, 2014 at 11:44 UTC | |
|
Re: same encrypt word ?
by Loops (Curate) on Oct 30, 2014 at 10:56 UTC | |
by docofchaos (Novice) on Oct 30, 2014 at 11:05 UTC | |
by Loops (Curate) on Oct 30, 2014 at 11:40 UTC | |
by docofchaos (Novice) on Oct 30, 2014 at 11:55 UTC |