This is not an answer, sorry. I searched CPAN and found many modules dealing with Digest; the most common ones (MD2, MD4, MD5, SHA-1) produce strings longer than 20 bytes... Here is the code I used to test it:

#!/usr/bin/perl use strict; use Digest; my $data = "message to be digested"; for ('MD2', 'MD4', 'MD5', 'SHA-1') { showme($_, Digest->new($_), $data); } exit; sub showme { my ($mode, $digest, $data) = @_; $digest->add($data); print "Digest::$mode\n"; print "binary (length): ", length($digest->digest), "\n"; print "hex : ", $digest->hexdigest, "\n"; if ($digest->can('b64digest')) { print "base64 : ", $digest->b64digest, "\n"; } print "\n"; } __END__ # output Digest::MD2 binary (length): 16 hex : 8350e5a3e24c153df2275c9f80692773 base64 : g1Dlo+JMFT3yJ1yfgGkncw Digest::MD4 binary (length): 16 hex : 0962f09cec91822209796b504862847b Digest::MD5 binary (length): 16 hex : d41d8cd98f00b204e9800998ecf8427e base64 : 1B2M2Y8AsgTpgAmY7PhCfg Digest::SHA-1 binary (length): 20 hex : da39a3ee5e6b4b0d3255bfef95601890afd80709 base64 : 2jmj7l5rSw0yVb/vlWAYkK/YBwk

Given these digest methods, only binary format seems suitable for your needs... does anybody know of other algorithms?

Ciao, Valerio


In reply to Re: Alternative Perl encryption module by valdez
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.