What is wrong with 16 bytes? You could always use substr {ducks for cover}

Why duck for cover? It's exactly what he should do. Digest::SHA1 is an excellent hashing algorithm that produces a 160 bit hash. If that's "too big" (for some curious reason) then take the first 10 bytes of an SHA1 hash; you'll have an excellent hashing algorithm that produces a 80 bit hash. The only downside is that the chance of colissions is much much higher.

BTW, you may note I've changed the subject line since SHA1 is not an encryption module; and I might also add that if the author doesn't know the difference between encryption and hashing, he probably shouldn't be doing either but instead read up on cryptography.

Using crypto the right way is hard, I can highly recommend you read some of Bruce Schneier's publications, such as Security Pitfalls in Cryptography and Why Cryptography is Harder than it Looks.


In reply to Re: Re: Alternative Perl hashing module by xmath
in thread Alternative Perl encryption module by Anonymous Monk

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.