There's no reason not to use Crypt::CBC.Unless performance is important.
use strict; use warnings; use Crypt::CBC; use Crypt::Rijndael; use Crypt::GCrypt; my $cbc = Crypt::CBC->new( -key => 'a' x 32, -cipher => 'Rijndael' ); $cbc->start('encrypting'); my $rij = Crypt::Rijndael->new( 'a' x 32, Crypt::Rijndael::MODE_CBC ); my $gcry = Crypt::GCrypt->new( type => 'cipher', algorithm => 'rijndael', mode => 'cbc' ); $gcry->start('encrypting'); $gcry->setkey( 'a' x 32 ); $gcry->setiv( 'b' x 16 ); my $plaintext = 'plain text' x 8192; use Benchmark qw( cmpthese ); cmpthese - 10, { 'Crypt::CBC' => sub { $cbc->crypt($plaintext); }, 'Crypt::Rijndael' => sub { $rij->encrypt($plaintext); }, 'Crypt::GCrypt' => sub { $gcry->encrypt($plaintext); }, }; $cbc->finish; $gcry->finish; __END__ Rate Crypt::CBC Crypt::Rijndael Crypt::GCrypt Crypt::CBC 74.2/s -- -83% -89% Crypt::Rijndael 430/s 479% -- -39% Crypt::GCrypt 704/s 849% 64% --
Upd: fix to improve Crypt::CBC performance
In reply to Re^3: Encrypting a Message in C# with Rijndael and Decrypting it on Perl
by zwon
in thread Encrypting a Message in C# with Rijndael and Decrypting it on Perl
by zeussn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |