in reply to Alternative Perl encryption module

10 bytes is 80 bits which is 2**80 units of complexity. Typically the minimum that most digests use is 128 bits to get enough entropy. A binary Digest::MD5 digest will be 16 bytes long. A hex digest will be 32 characters long. A base64 digest will be 22 characters long. Binary is of course the most efficient presentation.

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

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Alternative Perl hashing module
by xmath (Hermit) on Mar 10, 2003 at 13:23 UTC
    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.

      I am the original author-the reason I am looking for a smaller hash is that I am using it in connection with compression, so the smaller the better-as is clear I know very little about encryption but for my purpose I do not need to know the background theory-I think I'll go with the idea of using the first ten bytes of the SHA1 digest-Thanks for all the suggestions!!!-Val