If I understand your intent correctly you have some message text that you wish to hash to 64 bits. The funnelling weakness is a potential issue for the hash algorithm, but is not a concern for the one off (per message) mixing of, say, a 128 bit MD5 digest down to 64 bits. By using an xor mix of the two 64 bit fields you are retaining the entropy and distribution characteristics present in the individual fields so long as there isn't a problem with coupling between bits (and for MD5 that seems unlikely).

The sort of code I had in mind would be something like:

use strict; use warnings; use Digest::MD5; my $msg = 'The quick brown fox jumps over the lazy dog.'; my $digest = Digest::MD5::md5_hex ($msg); $digest = substr ($digest, 0, 8) ^ substr ($digest, 8, 8); print unpack ('H16', $digest), "\n";

Perl reduces RSI - it saves typing

In reply to Re^7: 64-bit digest algorithms by GrandFather
in thread 64-bit digest algorithms by BrowserUk

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.