At a totally wild guess, I'd think that the message means exactly what it says, and Rijndael expects blocks of data that are multiples of 16 bytes in size.

Try this:

my $cipher = new Crypt::Rijndael "a" x 32, Crypt::Rijndael::MODE_CBC; my $usernameCrypt = $cipher->encrypt($username^("\0"x16));
That should work, as long as length($username)<16.

The trick here is that the XOR will extend "length($username)" without changing the values.

Note that that's a) totally untested and b) may or may not be a secure way of using Rijndael, I have no idea.

Of course, if "a"x32 is your key, the security of my trick is the least of your worries :)
--
Mike

Edit:"\0" rather than '\0', that's what I get for working in C yesterday...


In reply to Re: Crypt::Rijndael by RMGir
in thread Crypt::Rijndael by olly

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.