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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.