Recently I had a need for a CSPRNG (Cryptographically Secure Psuedo-Random Number Generator), and so wrote a module to wrap a Perl implementation of the ISAAC algortihm into a drop-in replacement for the built-in rand() function. The module, named Crypt::Random::ISAAC, also uses natural timing discrepancies to produce a random seed value.

As I work toward preparing this module for CPAN release, I find myself desiring some code review. There are some things I know (like I don't have unit tests), but I'm sure there are better/different approaches, and I would very much appreciate wisdom from other Perl developers. Since the only other Perl folk I know are my brothers and sisters in the Monestary, I humbly ask for some code review from you.

The module is published here, on PM, under the node Crypt::Random::ISAAC - secure random number generator. The functions isaac() and randinit() are not written by me, and the package globals they used were not created by me -- so, while I appreciate comments on them, I am loath to change those particular functions at this time. The code style is by perltidy, so please no comments about formatting. ;-)

Anything else is welcome, even if it be flame; however, I request that opinions be defended with excerpts from code and comments, if possible -- I'm not the brightest Monk, so those excerpts will help me to understand the opinions.

Thank you, great and wise Monks!

Larry Wall is Yoda: there is no try{}
The Code that can be seen is not the true Code

In reply to Code review for Crypt::Random::ISAAC by radiantmatrix

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.