I don't know enough about Twofish_PP (or other modules or conventions associated with this algorithm) to say what sort of formatting issues are assumed. Does the fact that it only deals with 16 bytes at a time mean that the output should be structured as lines of 16 characters terminated by newlines? Does this matter?

There are a number of ciphers that fall into the category of block ciphers. They encrypt a chunk (block) of plain text at a time. To encrypt a plaintext string that is longer than this block size you chunkify the plain text into chunks of the correct length, encrypt each chunk and join the resultant ciphertext blocks together. This is called cipher block chaining and is implemented in Crypt::CBC. You do need to pad a plaintext string less than block size to encrypt it. There are a number of different ways to pad. Read the Crypt::CBC docs for a nice discussion.

Crypt::DES, Crypt::DES_EDE3, Crypt::IDEA, Crypt::Blowfish, Crypt::Twofish and Crypt::Rijndael are all modules that implement block ciphers and need Crypt::CBC or the equivalent to encode arbitratily long plaintexts.

cheers

tachyon


In reply to Re: Re: Twofish_PP.pm by tachyon
in thread Twofish_PP.pm by Baratski

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.